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