Keeping unused hard disks unmounted

The question

How do you prevent Mac OS X Leopard from auto mounting disks, drives and volumes when the computer boots up or a user logs in? (skip to the solution)

The preamble

I have spent days (literally) searching for the answer to this one; I have a Mac Pro running Leopard with (count them) 4 internal hard drives. One is my system disk and the other 3 are backup disks. Two are weekly mirrors of my system while the third is a daily snap shot of my user account. We won’t even get into the external disks I have. Yes I am THAT anal about my data.

So what is the trouble here? When you have this many disks containing duplicate data, Spotlight, QuickSilver, Launchbar, Google QSB, etc… they all want to serve up information found on each disk. That would include duplicate information that you most likely don’t want to inadvertently open and/or edit. But further to this, why spin up a disk, potential shortening it’s life span and wasting precious energy, when it only gets used on occasion?

One way around this is to diligently eject each volume every time you boot up your system. But that is both a pain in the butt and no where near as geeky as it should be. So do a quick search on Google for a solution to “unmount disk on login” or “prevent volumes from mounting at the boot up in Mac OS X Leopard” and you get a great deal of outdated info, inefficient Apple Scripts, overly complex bash commands, apps that wrap bash in an executable app that you launch at login when the moon is at… you get the idea.

So I set forth to put together the best of the best and simplest of the simple and post it here, for my own reference, exactly what I did to prevent my back up volumes from mounting on boot up.

My Solution (proceed at your own risk)

First off, what you are going to find with most solutions out there is the need for a file called fstab in the systems hidden “/etc” folder. The trouble is that later versions of OS X (10.4.x and later) don’t have this file. However, there IS a redundant file called fstab.hd. WE ARE NOT USING THIS FILE. Instead we will create our own fstab file. So with that out of the way, let’s get started:

The short of it

  1. Start by making a backup of your system. If you bugger up your system you’ll have something to recover from.
  2. Open terminal (/Applications/Utilities/
  3. Do one on the following:
    • In Terminal, type the following (with your volume name) and return *:
      diskutil info /volumes/DiskName
    • Or, you can use Apple’s Disk Utility app (/Applications/Utilities/Disk, select the disk in question and choose “info” from the toolbar.
  4. Find the Volume UUID (Universal Unique Identifier). Copy the UUID to your clipboard **.
  5. In Terminal enter and return ***:
    sudo pico /etc/fstab
  6. Enter your password and return.
  7. You’ll enter a window that looks like this:
  8. Enter the following (with your UUID) and return ****:
    UUID=87635CC4-B2EF-3114-B854-F64347A39630 none hfs rw,noauto 0 0
  9. Repeat step for each device you with to hide, each on a new line.
  10. Exit pico (⌃X) and save (Y).
  11. Press return when prompted with:
    File Name to Write: /etc/fstab
  12. All that’s left to do is is cross your fingers and reboot your Mac.

The long of it

  • * substitute “DiskName” for the name of the volume you wish to hide. If your volume name contains a space, like “Macintosh HD” you need to escape the space with a backslash so it looks like “Macintosh HD”
  • ** We use the “Volume UUID” as the disk identifier since it is not prone to change like “Device Identifier” (i.e. “disk0s2”) which can change with each and every start up.
  • *** This will create/edit your /etc/fstab file with pico, a simple text editor.
  • **** The string you are entering is the device id followed by the mount point, the filesystem, the mount options, the dump and fsck booleans. In this case:
    • the device is my UUID (UUID=87635CC4-B2EF-3114-B854-F64347A39630)
    • the mount point is “none” (because we won’t be mounting it)
    • the file system is “hfs” (since it’s formatted for Mac)
    • the mount options are “rw” (read-write) and “noauto” (volume will not auto mount)
    • the dump option (backup utility) and fsck option (filesystem check utility) booleans are both set to 0 (false, off, nil, nada) since we don’t plan to mount the volume and therefor don’t need to backup or check them

    For more on fstab column structures, visit tuxfiles fstab help.

The wrap-up

For whatever reason, Apple decided to nix fstab from it’s own Unix core. Perhaps for security or perhaps they just deemed it unnecessary. If you look in the other file I mentioned, /etc/fstab.hd (in terminal, enter and return: sudo pico /etc/fstab.hd), you’ll see the message:

This file does nothing, contains no useful data, and might go away in
future releases. Do not depend on this file or its contents.

However, I see no harm in extending the life expectancy of my disks and saving energy at the same time. All while doing away with the annoyance of long indexing times and being inundated with duplicate search results. If you have anything to add, please feel free to leave a comment.

Other references

  1. Mac OS X Hints from 2006
  2. Mac OS X Hints from 2005
  3. Mac OS X Hints from 2004
  4. Mac OS X Hints from 2003
  5. MacSeven from 2007
  6. Garbage In Garbage Out from 2007
  7. UUID on Wikipedia
  8. Pico on Wikipedia
  9. How to edit and understand fstab files