Near-line Data Backups With RDiff-Backup

Backups are great.  Yes, I’m that guy that loves backups.  Of course everyone uses an off-line, off-site backup system like JungleDisk, right?  Or if you’re lucky enough to have your own personal cloud, then you’ve got that covered from that angle…

But what about near-line backups, where you can rapidly restore data (like in the case of corruption or accidental deletion) without going through the work of remote restores?  For this type of backup and restore, I like “rdiff-backup“.  It is a tool that can be used many ways, but in the most basic use, will create a duplicated data structure — with metadata — for tracking time-based changes for the benefit of a time-based restore.  Sounds like that one well-known Mac tool, eh…?

To use rdiff-backup, you need to find it in your favorite Linux distribution and install the package.  Bam.  Then you use it.  Bam.  That easy.  But how do you use it?  Glad you asked…

Here are a few examples where I backup, compare, or restore data from my /home directory to /home.backup (note that the /home.backup directory is owned and controlled by the rdiff-backup tool’s tracking mechanism) :

Here’s an example to run nightly, like from a cron job or something:
rdiff-backup /home /home.backup
…or, with exclusions and a higher verbosity level…
rdiff-backup -v5 --exclude "/home/jpavlov/Photos" --exclude "/home/jpavlov/iFolder" --exclude "/home/jpavlov/windowsStuff" --exclude "/home/jpavlov/.beagle" /home /home.backup

Handy tip:
rdiff-backup --compare /home /home.backup
…or again, more specifically…
rdiff-backup --exclude "/home/jpavlov/Photos" --exclude "/home/jpavlov/iFolder" --exclude "/home/jpavlov/windowsStuff" --exclude "/home/jpavlov/.beagle" --compare /home /home.backup

To see the backups available from which to choose:
rdiff-backup -l /home.backup/

To restore to an alternate target:
rdiff-backup -v9 --restore-as-of "now" /home.backup /home.old/
…or…
rdiff-backup -v9 --restore-as-of "2008-01-20T19:39:51-05:00" /home.backup /home.old/

A couple notes here… of course, if you happen to have an encrypted /home folder (ahem), you don’t want to backup the folder out to a non-encrypted space, so be mindful of things like that.  And read the man pages, and the main site, which is filled with good docs and good examples…

Enjoy!

2 Comments

  1. Christian

    Jeremy,

    this is another great post.

    I would suggest for your application to use duplicity backup (http://duplicity.nongnu.org/)
    The main advantage of Duplicity is that it encrypts the backup files (both full and incremental) using keys. The key could be in your encrypted home so they can not be retrieved by anybody from the HD (after shut down)

    I have been using it for a year now. Duplicity backups my documents to a separate HD in the same machine (my near backup). Then I rsync (thru ssh) those files to another location thru the internet. I actually rsync the initial full backup locally and take that machine to a remote location. Only incremental backups are on the net.

    By having both backups encrypted, I am not concerned about any of the machines being stolen.

    The keys are copied in several locations (one of them is around my neck in a flash drive).

    I still have to polish some issues to make them bullet proof but for now, the files are safe in case they end up in the non-high-tech type of crooks.

    Regards,

  2. Jeremy Pavlov

    @Christian

    Cool tip, thanks for mentioning it! I’ll definitely look into it….

    8)

Leave a Comment

Your email address will not be published. Required fields are marked *