JJB Blog

Backing up my home directory using rdiff-backup

A while back I wrote about my backups scripts I made with rsync. I have since refined my scripts, and am now using rdiff-backup instead, which creates versioned backups. I delete backups older than 6 weeks, so I can roll back to any backup I’ve made in the last 6 weeks. I would prefer if I could specify the frequency of the versions… for example, make a backup a day for the past 45 days, and hold onto a version per month for every month before 45 days, forever. However, rdiff-backup does not support this. There are several hand-rolled solutions out there using bash scripts and rsync, however I prefer the plug-and-play ease of use offered by rdiff-backup.

My new dailybackup script is below.

[bash]
#!/bin/sh

ARCHIVEROOT=/Volumes/backup/backup ;

###########################################
## Home Directory #########################
###########################################
SOURCEDIR=/Users/john/ ;
ARCHIVENAME=PowerBookHomeDirectory-rdiff-backup ;

rdiff-backup \
-v4 \
–print-statistics \
–exclude-sockets \
–exclude $SOURCEDIR”tmp/” \
–exclude $SOURCEDIR”Library/Caches/” \
–exclude $SOURCEDIR”Library/Safari/Icons” \
–exclude $SOURCEDIR”Desktop/downloads/” \
–exclude $SOURCEDIR”.Trash/” \
–exclude $SOURCEDIR”Movies/Democracy/” \
$SOURCEDIR $ARCHIVEROOT/$ARCHIVENAME ;

rdiff-backup –print-statistics –force –remove-older-than 6W $ARCHIVEROOT/$ARCHIVENAME
[/bash]


6 Comments

Very nice! I think I’ll give this a try. No matter how I try, I’m still terrible at back-ups.

Posted by Jeff on 8 August 2007 @ 1pm

me too. Very nice.

Is the backup volume on the network, or local?

Posted by josh on 13 August 2007 @ 5pm

/Volumes on OS X is the mount point for external drives and network drives. In my case it’s an external firewire drive.

Posted by John on 13 August 2007 @ 5pm

Any opinion on services like Mozy?

Hmm … do links work? Test: Mozy

Posted by Max Starkenburg on 24 August 2007 @ 1pm

I’ve never used one of those services. I could used rdiff-backup to push the backups to my dreamhost account, but that would take hours and hours for the first backup and a lot of time for each subsequent backup. I suppose I could do it in the middle of the night…

Posted by John on 25 August 2007 @ 9am

Yeah, it’s taking a while (~1.5 gb/day) for me on Mozy, but I’m not backing up everything, and I just leave it running all the time (there’s a slider to adjust how much network it’s using, so that things aren’t super slow when I actually want to use the computer, but I put it back to full blast before going to bed or work).

Posted by Max Starkenburg on 27 August 2007 @ 11am

Leave a Comment