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.
-
Install
ipkg
. Some small details differ. Seeinstall-ipkg.sh
below. -
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.txt
with the password of the DSroot
account in it. Using theroot
account 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
.
- Make sure backups are stored in
/shares/MyShare
, as/shares/OpenShare
is readable by everyone on the network - we don't want that. We'll open upMyShare
later.
My rsnapshot.conf
is shown below. The excludes in the configuration are inspired by this Stack Exchange question.
-
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
).