Other Hardware

Wiki Resources

Sponsored Links

rsnapshot is a great replacement for the built-in backup script the NSLU2 provides. As well as providing a copy of the data in some other place (probably another drive), it also provides versioning of your data so you can recover from an accidental file deletion, corruption, or unwanted change. Commercial products refer to these version as snapshots(approve sites). rsnapshot can also be used to make backups of remote machines via SSH.

(OpenSlug doesn't require unslung-feeds here, but does require perl-modules after perl - this takes ages and installs huge numbers of packages, you could probably install a subset of the modules based on the use directives at the top of rsnapshot.)

4. Ignore any warnings/errors about missing tr/cmp if they occur, otherwise try to figure out what went wrong.

5. Complete the install:

/opt/bin/make install

6. Fix a small bug with the du feature in rsnapshot 1.1.7:

sed -ie 's/system("du/system("\/opt\/bin\/du/' /opt/bin/rsnapshot

(the rsnapshot 1.2.1 version has a cmd_du arg to specify the path to du, you may want to consider this instead).

7. Copy the defaults file to your own:

cp /opt/etc/rsnapshot.conf.default /opt/etc/rsnapshot.conf

(OpenSlug: if you didn't tell configure otherwise with --sysconfdir, the conf files will be in /usr/local/etc)

8. Edit your /opt/etc/rsnapshot.conf file following the documentation included on the
rsnapshot website. Specifically pay attention to the following:

Uncomment the cmd_cp* line

Comment out the cmd_logger line

Comment out all the existing backup lines because they won't work with a normal NSLU2 configuration.

Consider uncommenting the lockfile line because the NSLU2 isn't the fastest machine in the world and snapshots can take a long time. This way they won't overlap and cause problems. [though - if you reboot or crash while a snapshot is happening then you'll need to manually remove the lock file]

Consider using logging by uncommenting and changing the logfile line. To get useful output also change the

loglevel to 5.

If you are lucky enough to have 2 physical drives then I'd recommend setting your snapshot_root to a different drive than the one your primary data is stored on.

10. If you got errors about your backup lines then double check you followed the rsnapshot manual
and used <tabs> instead of <spaces>.

11. Follow the instructions on HowTo.EnableLoggingInCron - at a minimum install the cronlogger script and change it's permissions so it can be run. If you don't then you will see rsync 13 errors in your log file and your snapshots will not be complete. If you've replaced the version of syslogd then you may not need to do this step and you can ignore the /opt/bin/cronlogger section in the next step.

12. Once you are happy with your configuration, you've added the cronlogger script and you've tested it, you probably want to schedule it in cron. Edit /etc/crontab and add something like this:

13. Repeat the above for any daily and weekly, again referring to the documentation and normal
cron rules for timing. Restart cron:

/etc/rc.d/rc.crond

14. Either wait until your next scheduled run or start one manually:

/opt/bin/rsnapshot hourly

15. Your first snapshot may take a long time to run. If you enabled logging then check your log file occasionally as it may be telling you that there is a problem and since the cron NSLU uses doesn't send mail you may not notice them.

16. You can have multiple different configuration files that allow you to have totally different configurations for certain backups. Again, read the rsnapshot documentation.

Update: if you install the unslung-feeds ipkg, rsnapshot 1.2.0 is now available prebuilt, depracating the requirement to build it from source on the NSLU2. simply issue the following commands:

ipkg install unslung-feeds
ipkg update
ipkg install rsnapshot

then configure as described above, from step 7 down.

Update: rsnapshot 1.1.6 and 1.2.0 had security problems, which were fixed in versions 1.1.7 and 1.2.1. Please do not use the earlier versions, as they are vulnerable. See http://www.rsnapshot.org details.

Update! rsnapshot doesn't seem to work properly when the link_dest option is configured!

I installed rsnapshot 1.2.9-1 using ipkg following above instructions on unslung 6.8beta. Each time it
ran, it seemed to take a constant amount of time and according to du, each hourly snapshot was taking up new space. After setting the link_dest parameter in rsnapshot.conf to zero (it defaulted to 1 in the package) rsnapshot began to behave as expected - 1st run was slow then subsequent runs took time proportional to what had been changed, so usually very fast. Also, the unnecessary space consumption problem appeared to go away.