Table of Contents

The rsnapshot backup solution


Rsnapshot is a filesystem snapshot utility for making backups of local and remote systems. Using rsync and hard links, it is possible to keep multiple, full backups instantly available. The disk space required is just a little more than the space of one full backup, plus incrementals. See the rsnapshot web site for more information.
A good read is the Rsnapshot HOWTO.

Another article worth checking is my companion article about using a Linksys NAS as rsnapshot server.

Getting the software

I have created a Slackware package for rsnapshot that you can download from my SlackBuilds repository.

Installing rsnapshot

These are my notes on setting up “rsnapshot” so that it can start backing up (creating multiple snapshots) remote servers on the LAN or even on the Internet(at least those that have sshd running and ssh as well as rsync installed). In this document, is will call the machine that is running rsnapshot the backupserver. The machines that are going to be backed up are called the target servers or the remote servers.
Basically, using rsync over an ssh connection means that you have to do two things:

  1. Make sure the backupserver can login to the target servers using ssh, without requiring a password. We will achieve this by configuring the targets for “public-key authentication”.
  2. On the target servers, do not run as the root account, but use a dedicated non-privileged account (called for instance “rbackup”) that is allowed to do only one thing after logging in using PubKeyAuthentication: to run the rsync command.

Good example docs about how to set this up are:
http://blog.innerewut.de/articles/2005/05/25/remote-filesystem-snapshots-with-rsnapshot

and it's follow-up article:
http://blog.innerewut.de/articles/2005/06/03/follow-up-on-remote-filesystem-snapshots-with-rsnapshot

as well as some improvements to this:
http://sourceforge.net/mailarchive/forum.php?thread_id=8991705&forum_id=41320

Now, some detailed instructions compiled from the above sources:


Configuring the backup server

This is a sample last line in our /etc/rsnapshot.conf on the backup server:

backup<TAB>rbackup@fileserver.my.lan:/home/<TAB>fileserver.my.lan/<TAB>rsync_long_args=--rsync-path=rsync_wrapper.sh --delete --numeric-ids --relative --delete-excluded

And this is what should go in the crontab for root on the backup server:

0 */4 * * *       /usr/bin/rsnapshot hourly
30 23 * * *       /usr/bin/rsnapshot daily
15 22 * * *       /usr/bin/rsnapshot monthly

Configuring the remote server(s)

Testing remote login

When all configuration is complete, and before your scheduled cron jobs start, you should test whether the non-interactive passwordless login from the rsnapshot server to the remote rbackup account is functional.
You need to make a ssh connection at least once, to add the public key of the remote machine to your root account's known_hosts file.

# ssh rbackup@client.my.lan
Rejected 3
Connection to client.my.lan closed.

The “Rejected 3” message actually means that your configuration was successful!