The Decider said over 3 years ago permalink Comment? (0)
Tagged: unix backup rdiff-backup

rdiff-backup

rdiff-backup is a wonderful program. There I said it! I’m in love with a backup program. As chief cook and bottle washer I must backup our servers (off-site) and systems in the office and there is no better way that I’ve found than rdiff-backup,

First off there is no restore command or shall I say not a conventional one. Just use cp . rdiff-backup, RDB, creates a mirror of the machine you are backing up so just go to that directory and copy the files or drag and drop using a gui. The files in the mirror are from you last backup. Of course RDB stores incremental reverse diffs so if you need to see that file that’s gone missing it’s pretty easy to do that but you’ll need to use RDB’s command line interface.

Here’s my backup scheme…Most of our backups are done using a 3rd party user called backthatassup . ‘backthat…’ stores his (her?) RDB commands in a crontab that looks like this:


00 11 * * * sudo rdiff-backup -v6 --print-statistics  \
                 --exclude '/mnt/home/home/**/.Trash/'  \
                 --exclude '/mnt/home/home/**/.google/'  \
                 --exclude '/mnt/home/home/**/.cache/'  \
                 --exclude '**.log'  \
                  /mnt/home/home  \
                  /media/disk/backups/jokerman/home 

# cleanup backups each month to only hold 2 months worth of data

@monthly  sudo rdiff-backup -v6 --print-statistics \
                  --remove-older-than 2M \
                  --force \
                  /media/disk/backups/jokerman/home 

The first command runs daily at 11 am and backups up the directory:

/mnt/home/home

The backup is stored at:

/media/disk/backups/jokerman/home

The options:

  • -v6 – verbosity level
  • —print-statistics – gives a summary at the end of the backup.
  • —exclude – the directories and files I don’t want to backup.

The second command runs monthly and removes all files older than 2 months old.

Restoring files that are older than the current mirror is pretty easy. You can specify that you want a file from a specific date or relative from now. To restore the file, file.to.recover from 10 days ago try:

rdiff-backup -r 10D /my/backup/location/file.to.recover \ /and/put/it/here/

RDB runs on most unix, mac os x and window’s platforms. I personally use it to backup all 3 of those platforms on to my ubuntu machine which has a couple of external harddrives for storage. When backing up machines on the internets all data is transferred using ssh. Read Secure. RDB uses the rsync library so only changed versions of files are sent. This is handy when backing-up large log files that may be gigabytes in length but only increase by tens of megabytes each day. Only the additions are sent NOT the whole file.

More examples.

rdiff-backup home

Comments

simple_captcha.jpg
Are you a Human? Type the code above.