Generally when you either partition your Mac’s boot drive, or attach a secondary drive to your Mac, then provided the partition’s formatting is compatible with OS X, you should see it mount and be available in the Finder. However, there may be times when you might wish to keep a partition hidden, either because you do not use it, or because it is not intended to be shown in the first place.
Some examples of this are the “EFI” or “Recovery HD” partitions on your boot drive, that support system functions but are not intended to be accessed directly; however, in some cases (especially in dual-boot environments) you might find these showing up. Of course, modifying the contents of these may destabilize your system or prevent some features from working properly, so you might want to prevent these from mounting.
If you have partitions showing on your Mac that you would like to hide, then you can do so, but will need to get under the hood with some Terminal commands. Don’t worry, the methods used here are entirely harmless and can easily be undone:
1. Get the partition’s UUID
The volume’s UUID can be found and copied here in the Disk Utility info window (click image for larger view).
Open Disk Utility, where you should see the list of volumes (partitions) for each drive on your Mac. Select the drive you want to hide, and press Command-i to get information on it. Resize the info window that appears to reveal the entire Universal Unique Identifier (UUID) for the drive, and then select and copy the entire UUID.
The UUID can also be found in the Terminal by typing “diskutil info,” followed by a single space, and then dragging the desired hard drive to the Terminal window before pressing Enter. For instance, the following command will get info on a volume called “EFI”:
diskutil info /Volumes/EFI
You can then find “Volume UUID” in the output of this command to find the UUID needed to hide this partition.
2. Edit or create the “fstab” file
The “fstab” file is a hidden system file that is used to specify how partitions are handled in OS X, where you can have them mount at specific points other than the default, or mount only in read mode. We are going to use it to prevent the partition (identified by its UUID) from mounting.
To create or edit this file, open the Terminal and run the following command from an administrative account:
sudo pico /etc/fstab
This will open an editor, in which you will enter the syntax needed to hide the drive.
3. Add the fstab commands to hide the drive
Enter the following command, replacing the UUID consisting of zeros with the one you copied for your partition’s volume.
UUID=00000000-0000-0000-0000-000000000000 none hfs rw,noauto
What this command does is specify the identifier (the UUID), then the mount point (none), followed by the format (hfs), and then options (read/write, and no auto mount). The keys here are that the mount point is set to none, which prevents the drive from mounting, and noauto, which prevents an attempt to automatically mount it.
The UUID specified (arrow) in the fstab file will be set to not mount automatically.
You can specify as many drives you want in the fstab file, by adding one per line. When finished, to save the file press Control-O (this writes out the file), and then press Control-X to exit the editor.
With the fstab file updated and saved, you can now reboot your system, and the specified drives should no longer automatically mount. Keep in mind that this will only pertain to the current operating system, so if you dual-boot your Mac and see these drives load in more than one OS X installation you use, then you will have to follow these instructions to edit the fstab file for each OS.
While this can be used for hiding system partitions like the Recovery HD and EFI, you can also hide any other partitions you might not want inadvertently modified. Just similarly add them to the fstab file, followed by rebooting and they should also hide.
Undoing the changes
If for some reason you no longer want a partition hidden, then simply edit the fstab file and remove the line that specifies the partition. If you have not used the fstab file for other purposes, then you can also simply delete it by running the following command in an administrative account, followed by restarting:
sudo rm /etc/fstab