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
.
To be able to make backups of the entire system, including DSM configuration and any other modifications, the NS2 needs SSH access with root permissions.
-
Enable the User Home Service on the DS.
-
Generate a public key on the NS2.
-
Enable SSH with SSH keys (this is a Synology-specific manual). Use the NS2 key from
/root/.ssh/id_rsa.pub
. -
Enable the rsync daemon on the DS. Otherwise you'll get strange rsync errors on the NS2.
Note: SSH with the default encryption is pretty heavy for the CPU of the NS2. You'll get a transfer speed of 3-4 MB/s. I've yet to test arcfour encryption or using the rsync daemon directly (i.e. without encryption).
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 up MyShare
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
).