[lug] Automated USB Drive Backup

Ben bluey at iguanaworks.net
Mon Oct 29 18:11:08 MDT 2007


Slightly off topic, but I'd recommend looking at dirvish 
(http://www.dirvish.org/) for doing rsync-like backups. It is a set of 
scripts the calls rsync, but instead of just syncing the two drives is 
does an archive. For every file that hasn't changed it creates a hard 
link between the files and for changed files, it makes a new copy of the 
file. It is very space efficient if only a few files change over time in 
a large backup -- I've got ~20 backups spanning over a year (daily for 3 
days, weekly for 2 weeks, then monthly, then quarterly) and it is uses 
only 50% more space of just one backup. Unlike typical diff archives, I 
can mount the hard drive and access each archive through the filesystem. 
It looks like a complete set of full backups, except it "magically" 
doesn't use all that hard drive space. It's great when someone deleted a 
file a week ago and needs it now.

I've got an hourly cron job that looks for my off-site external usb hd 
and if it sees it and hasn't done a sync recently, it runs rsync (I 
rsync a dirvish archive, but you could call dirvish directly) and 
e-mails me when it is done telling me to remove the hard drive. Probably 
a little snazzier to use udev so it runs when you plug it in, but what 
I've got  works fine. The hourly cron job just looks at /sys/block/sda 
to determine if the hard drive(s) is plugged in and if it is the right 
hard drive. Unmounts when done.

Ben



More information about the LUG mailing list