How to prevent a volume from mounting at boot in OS X
You can keep any combination of volumes from automatically being available for read and write in OS X.
OS X will automatically attempt to mount an attached volume when the system is started, and if successful the volume will appear in the Finder either in the sidebar or on your desktop if you have these options enabled. However, there may be instances such as in multi-boot environments when you might want a specific volume to remain unmounted.
With multiple boot volumes in a system, when loaded in one operating system it is relatively easy to access and edit important files on the boot disk of other operating systems. Therefore, keeping the unused boot drive unmounted may be a preferred setup. Additionally, if you have numerous storage volumes for each OS and only wish to use one or two for your current boot system, then you might wish to keep those from mounting as well.
To set OS X up so it does not mount a drive at boot, you will simply have to instruct it to do so in the system's hidden fstab file, which is used for customizing drive mount points and other details about how a specific filesystem is handled.
The first thing you will need is the volume's UUID (universal unique identifier) number, which can be found by opening Disk Utility, selecting the volume of interest, and then pressing Command-i or clicking the blue information button in the Disk Utility toolbar. In the window that appears, locate and copy the UUID, which looks like a string of alphanumeric characters separated by dashes.
With the UUID, you can now create an fstab entry for the volume that prevents it from mounting:
- Open the Terminal utility (in the /Applications/Utilities/ folder)
- Edit the fstab file by running the following command (supply your password when prompted):
sudo pico /etc/fstab
- Create a new line at the end of the file that looks like the following (note: replace "NUMBER" with the full UUID string you copied from Disk Utility):
UUID=NUMBER none hfs rw,noauto
- Save the file by pressing Control-O, followed by Control-X to quit the editor.
Perform these steps for each volume you wish to prevent automatically mounting, then restart the system, and they should no longer automatically mount. If you need to mount the volumes, then you can open Disk Utility and select them followed by clicking the Mount button in the toolbar, and they should become available in the Finder.