Last active
December 16, 2015 07:39
-
-
Save fxbeckers/5400528 to your computer and use it in GitHub Desktop.
Prevent a given OS X partition from mounting at boot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
An /etc/fstab example: | |
# Identifier, mount point, fs type, options1 | |
UUID=DF000C7E-AE0C-3B15-B730-DFD2EF15CB91 /export ufs ro | |
UUID=FAB060E9-79F7-33FF-BE85-E1D3ABD3EDEA none hfs rw,noauto | |
LABEL=This40Is40The40Volume40Name none msdos ro | |
The Identifier is used to identify the volume; the LABEL is the volume name, the UUID is the Universal Unique Identifier Drive. You can use both, but the UUID is the best choice because renaming the volume will not change this identifier. | |
The mount point is the directory used when the volume is mounted; set none to use the pre-defined OS X directory, i.e. ./Volumes/ | |
The fs type describes the type of the filesystem; use hfs for a Mac volume. The field options describes the mount options associated with the filesystem. The option autowill mount the volume in the normal way, noauto will force the volume not to be mounted automatically; and last, use rw or ro for a read-write or read-only disk. | |
The UUID of a volume can be seen in Disk Utility (click the Info button and find the Universal Unique Identifier), or in Terminal using this command: | |
diskutil info /path/to/disk | |
In Mac OS X Panther, Disk Utility and the diskutil command doesn't display the UUID value. But if you look in the system.log file, when the disk is mounted, you can see something similar to this (line breaks added for narrower display): | |
... localhost diskarbitrationd[87]: disk1s9 hfs | |
77F3E84D-E0ED-3194-96A5-BED10893FFF4 FireWire HD | |
/Volumes/FireWire HD<br> | |
... localhost diskarbitrationd[87]: disk1s10 hfs | |
F0E430C1-5558-3BB3-9FA9-6904B663FEEA Mac OS X Disc | |
/Volumes/Mac OS X Disc | |
The string before the volume name is the UUID for the disk. | |
Now that you have a UUID for the volume to hide during the mount process, from an admin account edit your /etc/fstab file: | |
sudo pico /etc/fstab/ | |
Add a line with the UUID for your volume and the mounting point information, for example: | |
UUID=F0E430C1-5558-3BB3-9FA9-6904B663FEEA none hfs rw,noauto | |
Save the file and reboot (for internal drives) or unmount, disconnect and reconnect the volume (for external drives). Now the system should not mount the partition identified in fstab. You can still manually mount the volume in Disk Utility, or via the command line (and for a volume containing a boot system, rebooting from it). |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment