Stop Mac OS X from automounting all the drives

Mac OS X normally automatically mount all volumes or partitions it recognises at boot time. Sometimes you may not want this to happen (e.g. you have another Leopard or Snow Leopard installed for recovery purposes, when you boot one OS, you don’t want the others to be automounted).

This can be resolved using the file /etc/fstab. This file may not exist. You will need to create this file if it didn’t exist.

First, you need to find out the partition’s UUID.

UUID is Universally Unique IDentifier. It’s an identification code given to each storage device (e.g. partitions on your hard drives, USB sticks, DVD drives) on your system, aimed to help you uniquely identify each device. UUID ensures that the system recognises the same drive or partition when changes are made to the system (e.g. delete/create/merge partitions, or add new hard drives – these changes may change the device names).

A volume’s UUID can be obtained with the Disk Utility, select a volume from the Disk Utility, and click the Info button, the UUID of the selected volume will be shown, e.g. 1E749B30-355B-3881-B15A-03069F2C778E

In order to suppress automounting of the volume, issue the follow command in a terminal to edit the file /etc/fstab (it would create the file if it didn’t exist):

sudo pico /etc/fstab

and add the following content on one line:

UUID=1E749B30-355B-3881-B15A-03069F2C778E none hfs ro,noauto

To find out what each field means, use the following command at a terminal:

man fstab

Basically, the third field is the type of the file system (hfs is used by Mac OS X), and the fourth field is for the mounting options: ‘ro’ means read only (use ‘rw’ if you want read write after mount), ‘noauto’ means no automount at boot time, but you can mount the volume using the Disk Utility.

Save (ctrl-o followed by ctrl-x) the file and restart your mac for the effect to take place.

This entry was posted in Mac OSX and tagged , , , . Bookmark the permalink.

1 Response to Stop Mac OS X from automounting all the drives

  1. mehrab says:

    Hi it will not work if the volume is encrypted !

Leave a comment