NAS to USB automatic incremental backup

found a way to do it natively so may be others will find it useful.
what i want from my backup:

  1. automatic
  2. incremental
  3. NAS to attached USB drive.
    this functionality is not available out of the box. so here is a solution.

backup script can be placed anywhere, for simplicity we’ll put it in Public (/mnt/HD/HD_a2/Public/)
backup_local.sh:


#!/bin/sh
source=/mnt/HD/HD_a2/
dest=/mnt/USB/USB1_b1/backups

date=date "+%Y%m%d_%H%M%S"
rsync -rltDP
–delete
–delete-excluded
–log-file=$dest/backup-$date.log
–link-dest=$dest/current
–include ‘user1/***’
–include ‘user2/***’
–include ‘Public/’
–include ‘Public/books/***’
–include ‘Public/music/***’
–include ‘Public/photos/**
–exclude '

$source $dest/backup-$date

rm -f $dest/current
ln -s backup-$date $dest/current


more info about rsync time machine here: https://blog.interlinked.org/tutorials/rsync_time_machine.html

schedule
edit /usr/local/config/config.xml:


<crond>
	<list>
		....
		<name id="102">my_backup_local</name>	
	</list>
	...
	<my_backup_local>
		<count>1</count>
		<item id="1">
		<method>3</method>
		<1>0</1>
		<2>3</2>
		<3>*</3>
		<4>*</4>
		<5>*</5>
		<run>/mnt/HD/HD_a2/Public/backup_local.sh &amp;</run>
		</item>
	</my_backup_local>
</crond>

reboot NAS
done!

*** USE AT YOUR OWN RISK ***

Hi,

Thanks for sharing.

Please add a disclaimer to the users to let them know that they will be doing that at their own risk.

Thanks ERmorel! Of course:)

Hi, I did everything as described and wondering what should happen. I couldn’t find any new menu point or something in the settings. I’ve also made sure to use the proper single and double quotation marks in the file. Cheers

the task will run in the background, no new menu points/setting will be visible.
In the example above backup will run every day at 3am and will be stored in /mnt/USB/USB1_b1/backups/current
you should also see a log in:
/mnt/USB/USB1_b1/backups/backup-xxxxxx.log