Monday, February 2, 2009

New Years Resolution: Removable Media Backup

Removable and portable media, I've found, is one of the toughest things to make consistent backup copies of. After all, there is really no way to predict when and/or where my multitude of drives will be plugged in. Which led me to a simple solution, back them up when they are plugged in.

In the past, I've used rsync to make backups on a regular basis (using cron jobs). I devised a similar scheme to backup removable media.

A simple python script scans for mounted media. Drives that have been configured to be backed up are copied through rsync and ssh to the specified backup location. Drives/media not configured for backup are simply ignored.

The script looks for a two line text file in the root directory of each mounted drive to designate whether or not to backup the drive. The text file contains the volume's name (not to be confused with the portion label, this name is only for aesthetics and organization) and also the location the drive should be copied to on a remote host. The script then continues to archive the drive to the location specified. When done, it moves on to the next drive and so on.

The script and example config file are included in a tarball below. Comments and improvements welcome.

Download the Drive Booty script [Box.net link]

Creative Commons License
DriveBooty by Dana Simmons is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.

No comments: