Apple Intelligence now features Image Playground, Genmoji, Writing Tools enhancements, seamless support for ChatGPT, and visual intelligence.

Apple Intelligence has also begun language expansion with localized English support for Australia, Canada, Ireland, New Zealand, South Africa, and the U.K. Learn more >

You can make a difference in the Apple Support Community!

When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

Prevent a volume from mounting at startup

Last modified: May 16, 2023 7:46 AM
58 79574 Last modified May 16, 2023 7:46 AM

Sometimes, it can be useful to prevent a given volume from mounting at boot. You might want to hide an old OS version from Spotlight corruption. You just might not want to clutter your desktop.


Note: Encrypted disks are unlocked before the fstab file is read. In order for this procedure to work with an encrypted disk, you must first mount the disk, unlock it, and save the password in your keychain.


To do this, you will need basic understand of how to enter Terminal commands and use vi.


1) Make sure the disk you want to prevent mounting at boot is mounted.

2) Launch Terminal.

3) Run the following command to print out information about the disk:

diskutil info /Volumes/<volume that shouldn't be mounted>

4) Locate the line that starts with: Volume UUID:. Select the UUID (Universal Unique Identifier) that follows on the rest of the line. It will be something that looks like FF9DBDC4-F77F-3F72-A6C2-26676F39B7CE. Your value will be different

5) Copy the UUID to the clipboard.

6) Navigate to /etc by typing the following and pressing enter:

cd /etc

7) Edit (or create) an fstab file by typing the following and pressing enter:

sudo vifs

8) Enter the following line, substituting the UUID you copied in step 5). (Note: vifs uses the value of the EDITOR environment variable to pick the text editor to use. This article assumes you are using the default value of vim.) In vim, the editor starts in command mode. To add a new line, use the arrow keys to move to the end of the document and press the o key to append a new line and enter edit mode. Then type the following:

UUID=FF9DBDC4-F77F-3F72-A6C2-26676F39B7CE none hfs rw,noauto

and press the return key.

9) Type escape to return to command mode and then type ZZ (shift key down) to save and exit vifs (or some other method to save and exit if you are using something other than vim).

10) Type the following and press enter to reset the auto mounter:

sudo automount -vc

11) Quit Terminal


Now, the next time you restart, or unplug the drive in the case of an external drive, that volume will not be mounted. All you have to do is launch Disk Utility, select the grey, disabled volume, and click the Mount button.


You should be able to use a different text editor than vifs if you want. It needs to be able to edit and save files owned by root.


Note: If all of your disks are encrypted, there is an easier method. For any disk that you don't want to automatically mount, simply don't save the password to the keychain.

Comments

Aug 15, 2020 4:38 AM

Just one small addition to your excellent tip in the case a volume is formatted as "apfs":


UUID=FF9DBDC4-F77F-3F72-A6C2-26676F39B7CE none apfs rw,noauto

Aug 15, 2020 4:38 AM

Feb 14, 2023 4:54 PM

I would suggest the following modification for Step #7 to allow the use of the "nano" editor which is much easier for people to use than the default "vi/vim" editor:


EDITOR=nano  sudo  vifs


Feb 14, 2023 4:54 PM

May 16, 2023 7:46 AM

Step#9 should say "Press the ESC key to return to command mode". The current "Type escape" may have the user actually typing out "escape".

May 16, 2023 7:46 AM

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.