[lug] Automated USB Drive Backup

Hugh Brown hugh at math.byu.edu
Fri Oct 26 17:00:44 MDT 2007


karl horlen wrote:
>> I use a system somewhat like you are describing: 1
>> offsite
>> usb disk, one local usb for backup. Each with a full
>> copy
>> of selected file systems.
>>
>> You may find this kind of command useful:
>>
>> rsync -v --archive --stats --delete --backup
>>
>>
> --backup-dir=/backup/history/fileserv/20071026/photo1
>>  /photo1/ /backup/fileserv/photo1/
>>
>> By keeping per-day backup trees you get poor-mans
>> versioning
>> of file changes (only one version per day). For our
>> systems
>> we see from 12M to 2,000M deltas (big ones when a
>> photo card
>> is uploaded).
> 
> So your deltas are not really deltas.  They are
> actually mirroring the entire tree every backup cycle?
> 
>> My little backup system generates the rsync commands
>> as well as creating the history dirs for each date;
>> and
>> removing history days over 30 days old. Runs once a
>> night
>> at approx 3:00AM with no manual intervention. Don't
>> have
>> to fiddle with mount/unmount events as the
>> usb-connected
>> backup disk is always plugged in. I do the offsite/
>> connected drive swap during the day and don't worry
>> about auto-handling drive mount/unmount.
> 
> A late night or early morning job is exactly where I'm
> heading with the scripts because it simplifies the
> entire process.  I still would like know how to do the
> "hotplug" automount unmount capability because it
> would be pretty cool which is why I asked.
> 

The --backup flag for rsync doesn't do a full backup it just does a 
backup of what it is about to change.  Instead of overwriting the old 
copy of the file (i.e. the --delete), it will move the file it is about 
to overwrite into the --backup-dir.  So they are deltas.

udev is the hotplug mechanism these days.  If you go through the man 
page, do a bit of google, you should be able to piece together a udev 
script.  udev will match on what you tell it to (e.g. the usb vendor id 
or ...) and then run the script.  The script would then be responsible 
for taking care of the mount, checking if you want to do a backup or 
restore, ...


Hugh



More information about the LUG mailing list