Tuesday, July 24, 2007

System backup using rsnapshot

Rsnapshot is a filesystem snapshot utility that we can use for free to backup our system. To use this tool, user must have perl, ssh and rsync installed in their machine. Rsnapshot is an ideal tool for backup because it saves a lot of hard disk space. This can be done because the space needed is roughly the size of one full backup plus a copy of each additional file that is changed. The installation is also simple as shown below:

  1. install rsnapshot
    • -> yum install rcsnapshot
  2. after installation, do some setting in /etc/rsnapshot.conf . Some of the important settings are as below:
    • snapshot_root - change it to your preferred directory
    • cmd_cp - for linux user, uncomment this option
    • backup script
      • backup user@servername:/folder/to/backed-up destination/in/snapshot_root
    • interval - set this to set the frequency of snapshot to be taken. Please note that it must be arranged from smaller unit(hourly) on top to bigger one. For example:
      • interval daily 7 - this means snapshot will be taken 7 times a week
      • interval weekly 4 - this means snapshot will be taken 4 times a month
  3. Test the validation of the config file
    • -> rsnapshot configtest
  4. Test run your command
    • -> rsnapshot -t daily
  5. To backup, just run the below command(for daily)
    • -> rsnapshot daily

1 comment:

Anonymous said...

I wrote a similar backup program called GPB (http://www.masuran.org/gpb/) that uses only Bash scripting and rsync.

It provides almost the exact functionality like rsnapshot but it's more flexible when it comes to creating different backup schemes. Hourly, daily, weekly, two-hourly backups, everything is possible.

I actually wrote GPB before becoming aware of rsnapshot. The day I finished GPB (used in for production backups at my job) a friend mentioned rsnapshot to me.

The only thing I'd like to change about rsync is that it would be nice to save chunks of files and not the entire modified file. Backup up daily .pst files that are +1GB tends to eat away at your backup space ;)