Integrating Rsnapshot backups with Synology NAS systems

Rsnapshot is a simple but indispensable Open Source backup script that leverages the power of the rsync command (and SSH) to make backing up your Lunix/Unix infrastructure easy. It’s a must have tool in my opinion.

BTW, The best book for all things Unix/Linux Backup and Recovery (including Rsnapshot) is W. Curtis Preston’s Backup and Recovery from Orielly.

You can use Rsnapshot to write your backups to a second hard drive, an external USB or FireWire drive, an NFS mount from another computer on your network, or simply over the network to another computer via ssh.

I’ve started to incorporate these cheep and very capable NAS devices from Synology, namely the 8 bay DS1812+. I recommend these 3T Seagate drives with the NAS.

Out of the box, the Synology DS1812+ comes with a powerful web-based user interface that makes setting things up easy. It does not support Rsnapshot be default. However, because the Synology NAS is itself it’s own little Linux machine (its OS is based on the BusyBox distribution), it’s possible to SSH into it to make your own customizations. The steps bellow will walk you through installing the “ipkg” package manager (simular to Yum on RedHat based distributions, or apt-get on Debian), as well as installing and configuring Rsnapshot.

Step one: Installing ipkg.

This first step is specific to the DS1812 and assumse you’ve already created at least one volume via the web-based admin interface. If you have a different model, see here for more details.

First thing to do is to enable SSH via the NAS’s web-based admin page. This is in the “Terminal” section of the Control Panel. Once enabled, SSH into your NAS with username “root” along with your admin password.

Next we want to download and install the ipkg bootstrap script. We first change directory to the “@tmp” directory of your first volume, download the ipkg bootstrap with the “wget” command, make the script executable, and then run the script…

cd /volume1/@tmp

chmod +x syno-i686-bootstrap_1.2-7_i686.xsh
sh syno-i686-bootstrap_1.2-7_i686.xsh

After the script runs, you can delete it if you like. If your Synology NAS is using DSM 4.0 or newer you also have to edit /root/.profile and comment out the PATH and EXPORT statements at the top.

Now restart your NAS via the web-based admin page to finish the ipkg install. Once it’s rebooted, log back in as “root” via SSH.

Step 2: Installing Rsnapshot

Now that you have the ipkg package manager, installing rsnapshot (as well as many other Linux tools) is trivial… Along with Rsnapshot you will want to install “cron” in order to be able to automate/schedule backups. I also installed GNU screen, less, and mlocate to make life easier.

ipkg update

ipkg install rsnapshot
ipkg install cron
ipkg install less
ipkg install mlocate
ipkg install screen

There you go. The rsnapshot config file is located at /opt/etc/rsnapshot.conf

Note also that Cron on the Synology works differently than what you’re used to on most Linux distributions. For details on how to get cron working properly, see this thread on the Synology forums.