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

Adam Merrifield


11 thoughts on “Keeping unused hard disks unmounted

  1. Nice Adam. This is an area I have not spent much time in, the Console. I am planing on adding more drives this year and it is good to know this information. Thanks for taking the time to write it up with screenshots. 🙂

  2. Is there a similar way to do this for volumes on a disk. The volume itself does not have a UUID, can ‘Sudo Pico’ work with another form of identification?

    1. @JB you can potentially use the Disk Identifier (i.e. disk1s2) or perhaps even the mount point but the trouble is both of these can change at random where the UUID cannot.

      What sort of volume do you have without a UUID?

  3. This was driving me freakin’ nuts! I too was lost in the sea of crap offered up by Google’s search results. In fact, I found this page a more obscure way.

    I Google Image searched “fstab osx” and randomly clicked on one of the thumbnails to see an example of how an fstab file was supposed to look, and it happened to be the last picture from this blog entry, leading me here.

    I needed this because of my dual-booting MSI Wind, running XP and OS X, and for some reason the slipstream install partition (which I decided to keep in the event of kernel panics) kept coming up as damaged each boot up. That message ruins the elegance that OS X is supposed to be about.

    The only difference was putting “ntfs” in place of “hfs” to auto-unmount the XP partition, which I wouldn’t’ve thought to do if not for the footnotes, so I appreciated those.

    Anyway, thanks a ton for going through the tedium so I could keep my sanity.

  4. Does this still work in Sierra? It’s not working for me. Also, have you tried using the built-in tool “vifs”? Apple recommends that for editing fstab, but I’m not sure why.

    1. Hi Elliott,

      This should still work in MacOS Sierra as there are lots of other references on the internet about editing /etc/fstab in MacOS Sierra.

      As far as creating/editing that file, I’d recommend nano/pico or vim. I suspect that using vifs is a throwback to the fstab.hd file that I beleive is no longer supported.

      1. I have verified that vifs does edit /etc/fstab. /etc/fstab.hd still shows
        This file does nothing, contains no useful data, and might go away in
        future releases. Do not depend on this file or its contents.”

        It doesn’t seem to matter whether I use vifs, vi, or nano — the results are the same, it’s just a simple text file. Blocking mounts by UUID does not work for me. Maybe it’s because this is a Hackintosh.

Leave a Reply

Your email address will not be published. Required fields are marked *