Simple Rsnapshot Setup
Rsnapshot is a perl-based backup script manager. It is a journalised backup system – meaning that it copies all your files across to the backup media once – and then the only data it transfers after that is the changes. The backups appear on disk as complete copies – but where two generations are exactly the same file, they’re actually symlinked to the same data.
Backup Strategies
Rnsapshot has hooks for scripts that run before and after the actual snapshotting. I use the “before” script to:
- dump the mysql databases (see my earlier comments about mysql backups)
- take a copy of the svn repository
- mount the drive to back up to
The after script just unmounts the drive. To add these extra scripts you just uncomment the lines containing the cmd_preexec and cmd_postexec paths and point them to your scripts.
Getting Started
Well I could write a lot about this but to be honest I doubt I’d do better than the excellent rsnapshot howto so I suggest you read that for how to do it. Basically, enter the path you’d like to back up to, the interval you’d like to use, and then a bit further down the page which directories you want backing up (the default is /home, /etc and /usr/local) – then run the command! The howto even includes instructionsn on setting up cron to call the command regularly.
Rsnapshot Conclusion
Rsnapshot was a good tool to stumble upon as a learner sysadmin (which I am) and its very easy to use. I love the fact that it isn’t rocket science, but its a really nice, usable version of a collection of scripts which are duplicated by system administrators the world over. The file structure of the backups is the same as the content that is backed up and retrieving any generation is as simple as copying a file over. I’m sure there are other solutions out there, but I’m a convert and use it on all the local servers I administer (Ubuntu boxes, it works a treat).