2012
11.01

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
wget http://ipkg.nslu2-linux.org/feeds/optware/syno-i686/cross/unstable/syno-i686-bootstrap_1.2-7_i686.xsh

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.

  • First of all, rsnapshot. DSM 4.0 comes with an rsync-based backup system. It’s not bad but I specifically need ‘historical’ backups. With rsync backups, thus not ‘historical’, if a file is accidentally overwritten by another file, it’d be lost forever the next day (given I make backups daily). With rsnapshot backups, I’d be able to restore as many versions of the file as many backups I have made in the past.

  • Thanhd

    We have been using rsnspshot witht he synology for some time. One problem we have is, the whole Synology froze sometime when an rsnapshot job is running. The only way to get back on is to power cycle it! I have not been able to determine why.

    Synology support wipe their hands as soon as rsnapshot is mentioned as it is not a supported addon. In fact they told us we have to remove it or they won’t support any issue.

    Would appreciate any sugetion or tips on this issue

    Using the synology for rsnapshot is the single most important reason we got the synology.

    We got the RS810Rp+

    • Kevin

      @ Thanhd It sounds to me like your device has a hardware problem of some type. Or maybe your device is over heating. You should try to get it back to factory default and run it through it’s paces. See if you can make it freeze without installing Rsnapshot – thats the only way you are going to get help from them. Does the RS810Rp+ support any sort of disk checking?

  • Thanhd

    Kevin,

    Thank you for the suggestion. There is no way to run a hardware test that I know of. I have emailed Synology support to ask how to.

    We’ve been trying to get monitoring the Synology via SNMP. But I don’t know if the temp can be monitored via SNMP.

  • Thanhd

    I forgot to mention that, from what we can tell the OS is still running. Just that you cannot connect to it remotely. That is why I suspect it is a software issue.

    • admin

      My system (DS1812+) will let me a complete disk check on all 8 drives. You may need to format the whole thing to accomplish this. Also, are you able to ssh into the device when it’s not responding to the web based interface? What other ipkg packages are installed?

      I alos highly recommend you post a detailed question on the Synology user forums. I got a lot of help there.

  • Arlukin

    hmm thanks for the howto. Now it looks like my ssh user has been removed and I can’t login not even to the root account. So now a new adventure begins, finding a way to get in to the NAS again =)

    • Arlukin

      Great, I was able to login to the web interface. I got really scared for awhile..

    • Adrian

      Use telnet. :-)

  • admin

    I’ve noticed that I often have to re-enable ssh after updating the Synology OS. You may also have to delete a defunct host key sometimes.

  • C’al

    Great guide – thank you! One thing: you also need the util-linux-ng package, which provides a version of logger that supports the “-i” flag required by rsnapshot, as well as bash if that’s the shell you prefer using in your backup scripts

  • Cool blog! Is your theme custom made or did you
    download it from somewhere? A design like yours with a few simple adjustements would really make my
    blog stand out. Please let me know where you got your design. Thanks

  • Pedro Arreitunandia

    Hi !!

    Do you Elkarbackup ? It’s a opensource product that helps to configure rsapshot using a web inteface. http://elkarbackup.github.io/

    • admin

      I have not used Elkarbackup, it looks like a web interface for rsnapshot. Very interesting.