Recently, I became frustrated with the selection of backup tools available for the Mac. At the time, I wanted to use a tape drive to backup user data. I had an Exabyte VXA-1 kicking around the office. I’m not sure if the drive itself was broken or if Retrospect’s Mac OS X drivers for the tape drive were defective. Either way, I couldn’t get it to work. Shamefully, I admit that implementing a good backup scheme went on the backburner for a few months. Then, I thought of a way to use disk images to make incremental backups.
At the time, I was using Mike Bombich’s Carbon Copy Cloner to make a daily clone of the server’s drive to a portable FireWire hard disk. This worked quite well, but I only had one FireWire drive to use. So, while I could get a daily backup, I couldn’t get it off site in case of a disaster. Being that I’d recently started re-reading Unix Power Tools, I was in a scripting mood and decided to use the
find command and
hdiutil to roll my own backup system.
The basic idea is that I call my
bash script each night (easily accomplished with
cron). When the script starts up, it calls
find to search through a couple of folders for any files that have had their ctime or atime modified within the past day. Files meeting those criteria are copied to a staging location in
Once all of the files are collected, I use
hdiutil to create a read-only disk image of the staging folder. That disk image is then moved to a
Backups folder in
/Library. The next morning, I use Disk Utility to burn the latest disk image. Once a month, I burn a complete backup of the data folders using .Mac Backup (because it’s convenient. You could easily use the Finder if you so desired). I throw the DVDs in a binder and bring them home. Then, I bring each day’s disk image home and add it to the binder. Rinse, repeat.
One nice little bonus is that I have about a month’s worth of disk images in
/Library/Backups to work with. So when one of my users accidentally deletes last week’s TPS report, I can easily open up the past Friday’s disk image in the Finder and drag the file back into place. Quite convenient and saves me a trip home to bring in that day’s CD. If you’d like to see my handy work, you can find the script here.
What kind of tricks are you doing with disk images? Have a piece of Mac backup software you prefer?