Unmount FireWire drives after SuperDuper backup

May 17, '06 07:30:00AM

Contributed by: luomat

Like many people, I depend on SuperDuper (an award-winning backup utility) to make nightly backups of my Mac. I have it scheduled to run at 2:50 a.m., but in reality most of the time I run SD manually when I am finished for the day. I run a 'Smart Update,' and then have SuperDuper sleep my Powerbook.

This works great; in the morning, I can just pick up my PowerBook and head to the office. Except for one thing: the external FireWire drive is still attached. Sure I could just disconnect it, but do you want to see that dire message that appears when you disconnect a drive without unmounting it first? Me neither. The obvious solution: Tell SuperDuper to eject the drive when it is finished.

The problem: How? Simple. Write a small shell script to eject the drive and have SuperDuper run it after the copy and before the computer goes to sleep. Standard disclaimer: I've been using this successfully on a 15" PowerBook 1.5 GHz running 10.4.6 and SuperDuper 2.1 (v77). Use at your own risk, etc etc.

Here's what you need to to:

  1. Write the script. This is really easy. My script looks something like this:
    #!/bin/sh
    
    /usr/sbin/diskutil eject /Volumes/BootBackup 
    exit 0
    
    The #!/bin/sh line should be the first line.

  2. Save the file somewhere, such as ~/bin/ejectBootBackup.sh (you can call it whatever you like, that's just the name I use since my backup drive is called, uncreatively, BootBackup).

  3. Copy/Paste this line into a Terminal.app window:
    chmod 755 $HOME/bin/ejectBootBackup.sh
    That just tells Mac OS X that the script is a program to be executed. Be sure to press Return after that line. You should not see anything in Terminal after you paste that line of text in. If you did, something must have gone wrong. If you change the name of the file to something else, make sure to change the chmod line, too!

  4. Attach your drive, launch SuperDuper, click the Options... button. On the General tab, choose 'Sleep Computer' for the action to to be taken 'On successful completion.' Do not click OK yet! Now click the Advanced tab (located next to the General tab). Check the box next to 'Run shell script after copy completes.' Then click Choose... and select the file that you created in the second step. It ought to look something like this when you are done.

  5. Now click OK to get back to the main window. The main SuperDuper window now ought to look something like this. Note that "InternalHD" and "BootBackup" are the names I use. Yours may be different.
Now I get convenient nightly backups, a sleeping computer ready in the morning, and no scary warnings about having unsafely removed my backup drive!

Comments (9)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20060511125715782