OS X: Disable Automount for a Specific Partition

root's picture

In order to do this, you have to fire up a bit of terminal. If you are not familiar with the underlines of UNIX, you should document yourself more before proceeding.

So, I have a partition which I do not want to be automatically mounted on reboot because it is used by one virtualbox machine.
1. List the partitions with diskutil command:
mini:~ osx$ diskutil list

/dev/disk0 (internal, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *128.0 GB   disk0
   1:                        EFI EFI                     209.7 MB   disk0s1
   2:                  Apple_HFS mini                    127.2 GB   disk0s2
   3:                 Apple_Boot Recovery HD             650.0 MB   disk0s3
/dev/disk1 (external, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *3.0 TB     disk1
   1:                        EFI EFI                     209.7 MB   disk1s1
   2:                  Apple_HFS 3T                      2.4 TB     disk1s2
   3:                  Apple_HFS vbox                    610.0 GB   disk1s3

2. Once you find the target partition, do again diskutil on it but with info option:

mini:~ osx$ diskutil info disk1s2
   Device Identifier:        disk1s2
   Device Node:              /dev/disk1s2
   Whole:                    No
   Part of Whole:            disk1
   Device / Media Name:      3T

   Volume Name:              3T

   Mounted:                  No

   File System Personality:  Journaled HFS+
   Type (Bundle):            hfs
   Name (User Visible):      Mac OS Extended (Journaled)
   Journal:                  Unknown (not mounted)
   Owners:                   Disabled

   Partition Type:           Apple_HFS
   OS Can Be Installed:      No
   Media Type:               Generic
   Protocol:                 USB
   SMART Status:             Not Supported
   Volume UUID:              00000000-1B11-3GSG-B5E1-E00440844CD5
   Disk / Partition UUID:    00000000-CA38-4222-9778-2B1852C44C61

   Total Size:               2.4 TB (2390080942080 Bytes) (exactly 4668126840 512-Byte-Units)
   Volume Free Space:        0 B (0 Bytes) (exactly 0 512-Byte-Units)
   Device Block Size:        512 Bytes

   Read-Only Media:          No
   Read-Only Volume:         Not applicable (not mounted)

   Device Location:          External
   Removable Media:          No

3. Get the Volume UUID and add it to /etc/fstab but do not edit it directly. Use instead the command sudo vifs and add the following line to it:
UUID=00000000-1B11-3GSG-B5E1-E00440844CD5 none hfs rw,noauto

mini:~ osx$ sudo vifs
mini:~ osx$ cat /etc/fstab
#
# Warning - this file should only be modified with vifs(8)
#
# Failure to do so is unsupported and may be destructive.
#
UUID=00000000-1B11-3GSG-B5E1-E00440844CD5 none hfs rw,noauto

DONE!

Thou shalt not steal!

If you want to use this information on your own website, please remember: by doing copy/paste entirely it is always stealing and you should be ashamed of yourself! Have at least the decency to create your own text and comments and run the commands on your own servers and provide your output, not what I did!

Or at least link back to this website.

Recent content

root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root