Posted by: sureshamrita | August 28, 2010

rsnapshot backup

rsnapshot backup has the advantage that the recovery is very simple. The backed up files are kept as plain files (without compression) in the backup destination directory in the  hard disk and you need to just copy the files only when you want to recover. rsnapshot provides hourly / daily / weekly / monthly backups. This does not mean that the backup size is going to be huge as they maintain files without compression. Not exactly. Only the files which have changed between different runs of the backup, are copied as such. All other files are maintained as hardlinks and hardlinks takeup only very little space. Configuring rsnapshot is also very simple.

Most important thing first. How to recover? Just go to the backup destination directory. In this example, it is /backup/.snapshot. One can see directories such as hourly.0, hourly.1, hourly.2….daily.0, daily.1…, weekly.0, weekly.1….etc Each one of these directories will contain a complete copy of all the directories you wanted to backup at that instant of time.

Installation sudo aptitude install rsnapshot.

Configuration The Howto file in the rsnapshot web site, gives all the necessary information. However, some terms are described here. Open /etc/rsnapshot.conf

  • snapshot_root   /backup/.snapshots/
  • This is the directory where all backup files will be kept. This means that when you want to recover, you will first go to this directory

  • interval hourly 48
    interval daily 7
    interval weekly 4
    interval monthly 1

    For me it was confusing in the beginning to understand this. The first line above means that there will be 48 backups in a day (means every 30 minutes a backup is done). So once the backup system is up and running, the backup destination directory (in our example /backup/.snapshots/) there will be 48 directories named hourly.0 ….hourly.47. However please be noted that, just because we write hourly 48 in the configuration file, the backup program will not run 48 times a day. In fact, this entry only means that it will create 48 directories with name “hourly.xx” in the destination folder. How many times the program will run in a day just depends only on your crontab entry.

    The second line means that the backup destination directory will have daily.0 …daily.6 folders.

  • exclude *.o
  • I dont want the backup system be flooded with my obj files. Hence this entry.

  • backup /home/suresh/research localhost/
    backup /etc/ localhost/
  • This means that I need to backup /home/suresh/research and /etc/. You can have any number of entries here depending on your need.

  • Edit your crontab file (use the command $crontab -e as root) and add the following. (This is my example, your requirements may vary)
    */30 * * * *       /usr/bin/rsnapshot hourly
    15 13 * * *       /usr/bin/rsnapshot daily
    15 16 * * Fri     /usr/bin/rsnapshot weekly
    15 14 27 * *       /usr/bin/rsnapshot monthly

    If you do not remember the details of the crontab entries, please read the man page using the command man 5 crontab

    Acknowledgement: rsnapshot was introduced to me by my friend Dr Ninad . He also helped to me to configure it and understand it.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s


%d bloggers like this: