Keep disk volumes from automounting in Mac OS X

I currently have two large external drives with a number of partitions I’m using to clean up and organize my accumulated files. I only need to see those volumes when I’m actually doing the organization, and I definitely don’t want to see them when I’m running the App Store, as they really slow things down and result in a list of 45 applications that need updating. I decided to figure out how to keep them from showing up, and I’ll walk you through the process here.

Three things to know before we start: one, there’s a lot of simple terminal stuff in here. If the command line isn’t your thing, you many find this a bit daunting, and I’m expecting a passing familiarity with doing things in Two, you’ll hear a lot about fstab–the file that does the heavy lifting here–being “deprecated”. It isn’t, it’s just not used by Mac OS X for managing volumes by default. Three, you could screw up your Mac doing this stuff. I’m not sure how; maybe by setting your OS X partition to noauto? But you’re doing this at your own peril. Back up, back up, back up.

Finding the information you need

The first bit of info you need is the device identifier of the volume you don’t want to mount when your Mac starts up. Pop open a terminal and type diskutil list. This will give you all the connected devices, with a list of volumes. Copy the value under the identifier (it will look something like disk1s3).

Next, you need two things: the UUID and the Type. Run diskutil info on the device node of the volume. This is /dev/ followed by the identifier you probably have on your pasteboard. For example if the target volume has an identifier of disk1s3, run diskutil info /dev/disk1s3.

Creating the entries

At this point, I’d suggest opening another terminal window. In the new window, run sudo vifs. vifs places a lock on fstab, and opens it in vi. If you haven’t ever used vi before, it’s a bit different from, say, nano. I recommend reading through this overview of the basics.

Before you get to adding devices, I strongly recommend labelling each entry with the volume name. I do that by adding a comment with a description above the entry. Anything preceded by a # is a comment, so an example label would be

# Snow Leopard Back Up

Optional, but you’ll thank yourself next time you need to edit that file.

To explain how to create an entry, I’ll give you an example and then walk you through it:

UUID=8B6BA910-2F00-3008-ACD5-28D79AE2B236 none hfs rw,noauto

The first part identifies the volume this entry is for. Paste the UUID you see in the other terminal window directly after UUID=.

The second entry, none, is the mount point. By using none, you let OS X control the mount point, putting the volume in /Volumes as normal.

The third entry, hfs, is the type (more specifically the file system type), which you also find in the other terminal window. There are a number of possible options for this entry. For example, if you were hiding your Bootcamp volume, the type would likely be ntfs.

The final entry are the options for the volume. In this case we’re telling the Mac to mound the volume as read/write when we mount it. noauto is the whole point of this exercise: when this device becomes available, do not mount this volume automatically.

Repeat this for each volume for which you want to disable automount, then save and quit.

Finishing up

If you want to verify your work, dismount all the volumes on a drive, then disconnect and reconnect the device. Any volumes you’ve set to noauto should not appear in the Finder.

To mount a volume, use diskutil mount on the device node, eg diskutil mount /dev/disk1s3. You can also use the Disk Utility. In the GUI, select the volume you wish to mount, and click Mount.