There's nothing you can make that can't be made

What do you mean by “There are no backups” ?

Just a quick post on how I perform backups on my machines. It’s a really simple solution but its quick to setup and does the job.

And the job is : Keep my work safe.

First, two misconceptions I often encounter about backups :

  • Raid is not a backup. Period.

Raid is supposed to keep your stuff available when there is a HDD failure. It does not prevent Gooffy to rm -rf /var/db/$db with $db unset (true story, 15 databases gone), it does not prevent Doopey to cat /dev/random > /etc/apache/httpd.conf.

  • You do not have backup until you successfully restore

My favorite. Because what you want is getting back your file, do not consider that, because backups are running fine, you are safe. Murphy’s law says that if you only check backup, you will never be able to restore when you face a disaster.

So, test your backup. A good way is to clone your environment using the backup and check everything is fine.

Enters rdiff-backup

For my personal stuff, I use rdiff-backup. It’s simple and reliable, and restoring a deleted file is as simple as :

scp backup@backupmachine:machine/my/deleted/file old/emplacement/of/file

Backups are like a mirror of your file system, so restoring is simply a matter of copying the file back to its previous emplacement.

Increments are kept in the special directory “rdiff-backup-data/increments”. It can be browsed like a normal directory but files are stored in a specific way and rdiff-backup is needed to restore them.


My traditional setup is :

  • A server with some free space and a user dedicated to host the backups (As of now it’s a soekris 5501 running NetBSD with a 4200rpm 80GB 2.5″ HDD. Low-power and low-noise)
  • A dedicated ssh key pairs on each of my machines authorized on the backup account
  • A very simple script with an include/exclude file list, launched periodically by cron :

rdiff-backup \
--exclude-globbing-filelist=$CONF_DIR/filelist \

I do not (yet) need more. If my HDD burn, the real thing that matters is having my work safe. I can setup a new computer within an afternoon, but recreating everything I have on my drives would take eons.

Testing the backup

I had just set up my backups for a couple of day when I realized I had deleted one of my ssh private keys (I have copies of them, but not accessible at that moment). And of course, I had to use it for an urgent work.

First, let’s find my file. I want the very last version so I have to find the correct increment to restore :

$ ssh backup@$BACKUP_MACHINE 'find $HOSTNAME -name "hoth_id_dsa*"'

This is the last version of the file before its deletion. Rdiff-backup stores increments in a way that they are easy to query. It’s quite similar to a simple rsync of your backuped directory.

Because we know the exact file (or increment) to restore, we can use the command :

rdiff-backup backup@BACKUP_MACHINE::geonosis/rdiff-backup-data/increments/.ssh/
hoth_id_dsa.2012-11-08T10:46:13+01:00.snapshot.gz .ssh/hoth_id_dsa

I could have used the ‘restore-as-of’ option, to restore the file as it was at a certain point in time (for example, five days ago) :

rdiff-backup -r 5D backup@BACKUP_MACHINE::geonosis/.ssh/hoth_id_dsa \


Leave a Reply

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