- low memory usage
- fast!
- capable of backing up several directories in a single .iso image, ready to be burned.
I chose the ISO format instead of a disk image, because the first one is a more standard kind of disc image compared to the second one. It can be mounted and explored or burned on both Mac and on Windows machines (using the nice freeware tool called Daemon Tools, for example). Why did I code a script instead of using one of the tons of backup apps out there? Because the ones I tested don't do exactly what I need, and because doing the things I need myself and watching them work wonderfully makes me happy like a child who has finally received its most-wanted toy from Santa Claus! And by the way, scripting on Mac OS X is so easy that you can't really stop doing it once you get started.
Pre-requisites to run the script:
My script uses the great commandline utility called mkisofs that for Mac OS X is only distributed as source files, at least officially (on the website of the Author). But if you ignore what words like "source file" or "compile" mean, or if you (like me) can't or don't want to install the 1GB+ of XCode just for compiling the sources of mkisofs (that is a few KB utility), you can get the binary distribution in four easy steps:
- Download and mount the DMG image of the freeware software called DVD Imager.
- When it appears on the desktop, open it, control-click on the DVD Imager application, pick Show Package Contents from the pop-up menu, and navigate to Contents -> Resources.
- Copy mkisofs to your /bin folder using the Terminal and a command like the following: sudo mv /Users/eldino/Downloads/mkisofs /bin/. You need Admin priviliges to do this, so you have to logout from your daily-use limited account (you don't work daily as Admin user, right?) and log in as Admin (or ask the Admin of your machine to do it for you) to accomplish that mv job.
How the bashbackup script works:
- It creates a destination folder (ex. /Users/YourName/Backup).
- It creates a temp subfolder in the destination folder named following this scheme Backup_todaydate (ex. /Users » YourName » Backup » Backup_2007-12-30).
- It copies all your files and folders to back up to the temp subfolder.
- It creates a textual index of the content of your temp subfolder (i.e. Backup_2007-12-30_index.txt) in the destination folder (thanks to the author of this hint for the inspiration!).
- It creates the ISO disc image of the temp subfolder (i.e. Backup_2007-12-30.iso).
- It deletes the temp subfolder.
- Download it (1.5KB) and expand the archive.
- Copy eldino's_bashbackup.sh to a folder of your choice.
- Fire up Terminal, go to the folder where you saved the script and type chmod 755 eldino's_bashbackup.sh then press Enter.
Obviously, you can easily customize every key aspect of the script, like changing the destination folder or the ISO image naming scheme, adding/removing folders to the folders to back up list etc. For the script-editing part, I personally use the freeware developer-oriented text editor called Smultron, that colour your syntax and open multiple files in the same sidebar, but of course any other textual editor would be fine. To get the file paths of your folders to back up in a simple way, I suggest you to get the nice contextual menu plugin called FilePathCM; it's free and works great!
How to use the script:
I suggest you to run this script at least weekly, using a cron job. Then you can burn several ISO images on a single 700MB/4.3GB disc, or you can burn one image per disc. I personally like to burn seven or eight ISO images on one CD-R, because the personal data I back up don't take so much space (my ISO images are about 90MB to 100MB each). You can also call my script from inside an Automator workflow or an AppleScript, or use it with the nice app DoSomethingWhen (that permits you to, for example, run the script when you plug in your external drive). The possibilities are endless!
The possible usages of the textual index file include:
- If the text indexes reside on a volume indexed by Spotlight, you might be able to figure out in what image or images a specified file is placed in just typing its name or part of its name into the Spotlight search field.
- If the text indexes resides on a read-only media, like a CD/DVD, you can load them into a text editor and do a search for the file you need: if the search is positive, then you can mount the disc image, otherwise you can go forward with the next disc.
- Instead of creating an ISO image, you could create a single zip (or gzip, tar, or bz2) file, but you will lose the capacity (at least using the native Mac OS X tools) to explore the result without first expanding it.
- Instead of burning backup images on CD/DVDs, you could save them on an external drive and keep them there until the next Ice Age.

