Non-Imaginary Projects
 

Multi-DVD backups

Everyone knows they should be making frequent backups of their files. But if you don't have the bandwidth or hard drive space, it is frequently difficult to make a nice simple backup of everything. That's why I wrote this multidvd-backup.pl script; it lets me create DVD backups without worrying about what files will fit.

In the past two years, I have had 2 hard drives die on me; the first time, I had a recent backup of everything important, but still lost a fair number of other files. The second time, I did not have any recent backups, and I had to do a long filesystem recovery using dd_rhelp, still losing some portion of my files. Since then, I have set up a few simple backupninja jobs to preserve the important stuff, but my mp3s, photos, and games were left unprotected. What to do?

After trying a large number of backup programs, and being frustrated by almost all of them, I came across this script to copy files across multiple DVDs. I was pumped; finally the answer! Except... it kept dying before burning a DVD. Damn!

The difference between this and the other things I tried was that it was a simple shell script; I could rewrite it quickly and make it better. So that's what I did! I rewrote it in perl to make it a lot cleaner, and changed the logic almost entirely. multidvd-backup.pl is the end result, and I have successfully backed up 31Gigs worth of data to 8 DVDs.

The script

multidvd-backup.pl

How it works

This script works by building a list of all files in the specified directory tree, splitting them into batches which fit within the iso9660 filesystem, and then calling growisofs with a bunch of esoteric options. The entire process should be doable with only a few KB of free drive space, as most of the work is done either in RAM or directly on the DVDR.