Automatically Mount a Drive Before a Backup

A key part to my backup strategy is I run nightly clones of my machine to an attached USB drive. For a various reasons, I don't want that USB drive mounted on my Mac throughout the day. Having the Clone drive mounted can slow down my Mac as the drive has to spin up every time an open/save dialogue box opens and sometimes, despite being excluded from my Spotlight and Launchbar indexes, I'll find I accidentally open files from the clone drive rather than my internal hard drive. 

I'm making the move from SuperDuper! to Carbon Copy Cloner (CCC) for my nightly clone backups primarily due to CCC's ability to verify the checksum of my backups. One of the things I've found missing from CCC is that if my drive wasn't already mounted on my desktop the scheduled backup would be skipped. That's a problem and was resulting in many skipped backups. So, I needed to find a way to automatically mount my clone hard drive prior to any backup task running. With a little searching I found a couple of solutions.

Option 1:  Using AppleScript and iCal to mount Drives Before Launch

This is an easy solution courtesy of that uses a one line AppleScript and Calendar's ability to trigger AppleScripts as alarms. Detailed instructions are on the site, but in a nutshell you create a one-line AppleScript with the following: 

do shell script "diskutil mount /dev/*****"

Where you replace the asterisks with the Disk Identifier (found in Disk Utility) of your backup drive.  You then Save the AppleScript and create a calendar event just before your clone operation is scheduled to mount the drive.  

Option 2: Create A Shell Script for Your Backup Program To Run Pre-Clone

Both CCC and SuperDuper! have the ability to run  a shell script before copying files. Not being a shell script guru myself, I went searching for help and came across a handy post by T'N'T Luoma describing the problem and providing a simple shells script with instructions to customize and implement. By modifying the script using the instructions provided and saving it I can now prompt CCC to mount the drive itself.

Ccc mountNote that both CCC and SuperDuper! offer the ability to unmount the destination volume after the copy operation.