msgbartop
A chronological documentation test project, nothing serious, really!
msgbarbottom

24 Sep 2012 Using rsnapshot as backup solution

Posted by

This post describes short how to use rsnapshot as a remote filesystem snapshot utility, based on rsync that I use as my personal backup tool.
I have started using rsnapshot after using rsync and rdiff-backup and lost files because of file corruption.
rsnapshot is a great backup utility because it hardlinks files if they already exists and your backups does not take much more space than the actual filesystem you are backing up.
You need to configure passwordless SSH connection from the backup server to the file server if you plan to run this as a automated job using crontab.

This is the content of my config file (/root/scripts/rsnapshot-home.conf) to backup my remote fileserver

config_version  1.2
snapshot_root   /media/Backup/
cmd_cp  /bin/cp
cmd_rm  /bin/rm
cmd_rsync       /usr/bin/rsync
cmd_ssh /usr/bin/ssh
cmd_logger      /usr/bin/logger
cmd_du  /usr/bin/du
interval        daily   7
interval        weekly  4
interval        monthly 3
verbose 2
loglevel        4
logfile /var/log/rsnapshot-home.log
exclude_file    /root/scripts/rsnapshot-home.exclude
rsync_long_args --delete        --numeric-ids   --delete-excluded
lockfile        /var/run/rsnapshot.pid
backup  username@example.com:/export/files/      files/

The config file is tab delimited so you will get errors if you use space instead!

Running manual daily backup can be done with the command

# rsnapshot -c /root/scripts/rsnapshot-home.conf daily

You do now have a folder structure like this with your backups

/media/Backup/daily.0/files
/media/Backup/daily.1/files
/media/Backup/daily.2/files
/media/Backup/daily.3/files
...

Where daily.0 is the newest backup.

The backup files are store in the same form as in your file server so you can browse them using a regular file browser.
You can read more about restoring backups on the rsnapshot HOWTO.

You can also configure a report to be sent after every backup with the perl script rsnapreport.pl but I will not be covering that in this post.

Tags: ,

Comments are closed.