Mount / unmount external drive for Backup use

Mar 16, '07 07:30:03AM

Contributed by: Anonymous

I use Apple's Backup program to back up files from my computer every night to an external hard drive (that has only one partition) reserved for backups. Problem is that I don't like having it mounted all of the time, since it spins up whenever I save or open a document, etc. Instead, I prefer to mount/unmount the drive just prior to and after Backup runs, so that's it's not in the way when I don't need it.

  1. With the drive mounted, open Disk Utility and select the drive partition that will be the destination of the backup.
  2. Select Info, and make note of the Disk Identifier. In my case, it's disk1s10.
  3. Edit your crontab to contain the lines:
    59 3 * * * /usr/sbin/diskutil mount /dev/disk1s10
    15 4 * * * /usr/sbin/diskutil eject '/Volumes/The Annex'
    Replace the end of the first line, disk1s10 with the drive identifier from step one. Replace the end of the second line, '/Volumes/The Annex' with '/Volumes/name of your backup hard drive' (the quotes will handle any spaces in the drive's name).
Assuming that I do a backup at 4am, the first line will mount the disk at 3:59am. The second line will unmount the disk at 4:15am. Adjust the times accordingly, particularly the unmount time if you have longer backups. If you're unfamiliar with the vi editor in Terminal, select all of the text above and copy it. In terminal, type crontab -e, type i (insert), then paste. Hit Escape and type :q -- you're done!

Note that this won't be effective if you're backing up to a drive with more than one partition. Also, make sure that the unmounting time is somewhat beyond the time that your backups regularly finish. I've looked at the history of my backups and found that it always finishes in less than 10 minutes.

Comments (12)


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