Prevent Mac OS X from mounting a hard drive volume at boot

Reader Charles asked a great question after reading my post about hiding a mounted disk volume on the desktop. He asked, in a nutshell, how to cause Mac OS X to not automatically mount a volume. Basically, Charles wants to leave his bootcamp volume unmounted when in Mac OS X. As it sits, Mac OS X automatically mounts all non-removable drives at startup.

Here’s how. First and formost, don’t be a dumbass. Back up your system. Know how to recover if this hoses up your computer.

If running 10.4.x, you must create an /etc/fstab file. Here’s the setup and necessary steps. Keep in mind, if you hose your computer, you did it. I’m not recommending you take these steps!:

1. You need to know the volume name of the volume you’re trying to hide, and whether it’s formated in FAT32 or NTFS. For this article, we’ll assume the name of the Windows partition that I want to hide is WINDOWS, which is what I see mounted on my desktop.

From the terminal, enter the following, replacing WINDOWS XP with the name of your volume:
diskutil info /Volumes/'WINDOWS'

I’ve surrounded the volume name with single quotes since there’s a space in the name.

The resulting output from diskutil is (important part is highlighted in yellow):
imac:~ cbrewer$ diskutil info /Volumes/'WINDOWS'
Device Node: /dev/disk0s3
Device Identifier: disk0s3
Mount Point: /Volumes/WINDOWS
Volume Name: WINDOWS

File System: MS-DOS FAT32
Partition Type: Microsoft Basic Data
Bootable: Is bootable
Media Type: Generic
Protocol: SATA
SMART Status: Verified

Total Size: 20.6 GB
Free Space: 419.8 MB

Read Only: No
Ejectable: No

As you can see, my volume’s filesystem is FAT32.

2. Recent versions of Mac OS X ship without an /etc/fstab file. We need to create one. From the Terminal, issue the following command:
sudo tee -a /etc/fstab

3. Type in the following, substituting the name of your volume:
LABEL=WINDOWS none msdos rw,noauto 0 0

If your file system from step one was NTFS, enter:
LABEL=WINDOWS none ntfs rw,noauto 0 0

4. Press “control-d” to send an end of line character to the terminal, thus closing out the tee application and writing the file. You can check your new /etc/fstab file by typing:
cat /etc/fstab

5. Next time you reboot, your Mac should not mount the volume. You can check by opening Terminal and entering:
ls -aleG /Volumes

You should see only the names of the volume(s) you want mounted…

12 thoughts on “Prevent Mac OS X from mounting a hard drive volume at boot

  1. What if your bootcamp volume is FAT32? How does the syntax change in your suggested solution? Will the UUID even show up on the disk util terminal command if it is fat32?

  2. Note to Readers: I’ve updated this article to more succinctly explain how to unmount both NTFS and FAT32 volumes, using the disk’s label (name) instead of the overly complex UUID.

  3. This is not working for some reason on Leopard. It worked for maybe 2 weeks, then the Windows partition started appearing on the desktop again. I have recently intalled VMware Fusion so I’m wondering if Fusion is loading a driver or extension at boot time that is causing the Windows partition to mount?

    Ideas anyone?

  4. @WildPalms: VMWare did the same to me. It must be mounting the bootcamp partition in order to access it. I access the bootcamp partition via VMWare, so that makes sense.

  5. I can’t seem to get this working with Leopard: The error message I get after typing in the

    LABEL=WINDOWS none ntfs rw,noauto 0 0

    is -bash: none: command not found.

  6. @Harrison,

    Looks like you skipped step 2, which opens up a new file where the text string “LABEL…” is stored.

  7. @Chris — I worked around that problem and the output for /etc/fstab now reads:

    LABEL=Untitled none ntfs rw,noauto 0 0

    unfortunately the disk still loads at startup and I truly loathe my startup time on leopard.

  8. Pingback: seyDoggy Web and Graphic Design - seyDoggy weblog - my thoughts on the web and the mac

  9. Hey Guys, this post is pretty old but I have a similar problem as this however my drive is mac format HFS+ Will this procedure still work?

    Cheers
    Jason.

  10. @Jason: Hi! Mac partitions are always HFS+. A bootcamp partition cannot be HFS+. What we’re talking about here is a Bootcamp partitions (for Windows) that is either NTFS or FAT32, so I’m not sure I’m following your question.

  11. Pingback: Adam Merrifield { the collective } - the collective thoughts and web works of adam merrifield

Leave a Reply