I need a backup solution for my Synology DS215j NAS. My requirements are:
- a backup solution that pulls data from the Synology DS, so that it is not possible for malware on the DS to corrupt the backups.
 - a restore solution that is really easy to use for everyone else in my house.
 - highly frequent backups. With modern storage technologies, it's unnecessary to lose more than an hour's worth of work.
 
Also, I have a LaCie Network Space 2 lying around, which is perfectly up to this task. Let's install and configure rsnapshot*!
Note: proficiency with Linux is assumed!
* Although rsnapshot is easy to configure, it is slow (see here for more info - note that the NS2 also uses XFS). On my NS2, backing up 450GB (250,000 files) takes about 45 minutes, of which 25 minutes is spent on rm -rf hourly.24. Therefore I will look at transitioning to rdiff-backup in the near future.
The NS2 does not have the ability to create backups from another NAS (for example through rsync) through its web interface. Therefore, I need to install a backup utility through SSH.
- 
Update the firmware. The latest release (as of February 10th, 2015) fixes the Shellshock vulnerability. It would be a shame to have our little backup server hacked.
 - 
Disable software updates. This is so that our modifications will be left alone. Be sure to update manually once in a while.
 - 
Enable SSH (the procedure for firmware 2.2.8 should be fine).
 - 
As suggested in the manual for step 3, set up login with SSH keys. This makes it easier to administrate the NS2, as the password for root is disabled on every boot.
 - 
Install
ipkg. Some small details differ. Seeinstall-ipkg.shbelow. - 
Install rsnapshot:
ipkg install rsnapshot. 
- 
Enable the User Home Service on the DS.
 - 
Enable the rsync daemon on the DS. Otherwise you'll get strange rsync errors on the NS2.
 - 
Create a file named
/opt/etc/diskstation-rsync-password.txtwith the password of the DSrootaccount in it. Using therootaccount is required, because DSM does not allow reading of shares through rsync for other user accounts. - 
Remove world read permissions from the file - else rsync will complain:
chmod o-r /opt/etc/diskstation-rsync-password.txt 
Edit /opt/etc/rsnapshot.conf.
snapshot_root: make sure backups are stored in/shares/MyShare, as/shares/OpenShareis readable by everyone on the network - we don't want that. We'll open upMySharelater.interval: choose what suits you. Do read the rsnapshot documentation on what these values mean.rsync_long_args: using SSH and checksumming slows transfer speed down to 3MB/sec. Assuming a gigabit network, the NS2 CPU is the bottleneck. Setting--whole-fileand directly using the rsync daemon on the DS will achieve full transfer speeds.sync_first: if a backup is interrupted, you have an incomplete backup, which will take part in the rotation. Usingsync_firsteliminates this problem. Do take note of the special way you need to call rsnapshot (seecrontabbelow).backup: you need to specify every share explicitly.
My rsnapshot.conf is shown below.
- 
Set an editor to edit crontab:
export EDITOR=/bin/vi - 
Edit crontab:
crontab -e. See my crontab below. 
- Disable SSH logins on the NS2 (disable 
sshd).