Creating A Scheduled Bootable Backup
November 23rd, 2007 | by Tony Steidler-Dennison |I’m at the end of testing for a new schedule bootable backup routine. It’s pretty simple, involving Carbon Copy Cloner and two two-line shell scripts.
Though I like Time Machine quite a bit, it has one gaping hole - the inability to make bootable backups. I’ve already been through the process of restoring the Mini from a Time Machine backup. It’s not a bad process, but it does involve a complete re-install of OSX, followed by a lengthy migration of all the apps and settings from the Time Machine backup. Time Machine has put the necessity of backups firmly in my mind again, so I thought I’d come up with a system to create fully bootable backups automatically, without relying on Time Machine.
The system is comprised of three software components: Carbon Copy Cloner, the outstanding donationware drive clone tool, two simple shell scripts and the OSX diskutil tool. On the hardware side, I have a 320 GB Firewire 400 drive dedicated to backups, approximately 80 GB of which is reserved for the bootable backups. This is a GUID partition on the external drive that’s not normally mounted when the system boots (accomplished with a modfication to /etc/fstab that’s the stuff of another post).
As the bootable backup drive isn’t normally mounted at system startup, the two shell scripts perform the mounting and unmounting tasks before and after running the scheduled backup with CCC:
#!/bin/sh
diskutil mount /dev/disk2s2
and …
#!/bin/sh
diskutil umount /dev/disk2s2
Setting up CCC to perform the hard drive clone was also simple. I mounted the backup drive, opened CCC, selected the internal hard drive as the source, and the backup drive as the destination, leaving in place the default CCC option of “Copy everything from source to target.” I also checked “Erase the target volume” to assure that I’d start with a completely clean backup. For security, I clicked the lock in the lower right corner of the CCC window, requiring the admin password to make further changes.
To put the backup on a schedule, I selected Scheduled Tasks from the CCC menu and completed the scheduling details in the resulting window. In my case, I set the backup to occur at 1:45 AM every Monday morning.
Finally, I selected Advanced Options from the CCC menu, providing CCC with the full path to the scripts for mounting and unmounting the drive from the bottom two text boxes.
To test, I opening the CCC Scheduled Tasks window and clicked “Run.” The drive mounted, CCC performed the full backup (which took approximately 90 minutes), then unmounted the drive. I restarted the system, holding down the Option key during the boot sequence, then selected the bootable backup icon. It all ran perfectly well.
With a bit more exploration, I may end up with a single script rather than two. That script will check whether the backup drive is mounted, mounting if it’s not and unmounting if it is. It’s a marginally more complicated script, but much more elegant in its execution.
Between Time Machine and the new scheduled bootable backup routine, I have no fear whatsoever of a loss in productivity due to system downtime.
Technorati Tags:
Apple, Leopard, Software, Mac, Scripting, OSX















