3

I don't use the internal hard drive on my iMac any more, but for obvious reasons, it's awkward to remove it. I'd like to stop OS X from automatically mounting it when the iMac boots. Is this possible? I didn't see anything in Disk Utility that looked appropriate. I know I can unmount it myself, but I'd prefer if it were never mounted in the first place.

I found a previous answer that describes editing /etc/fstab. However on OS X 10.11 "El Capitan", this file contains only the following information:

IGNORE THIS FILE.
This file does nothing, contains no useful data, and might go away in
future releases.  Do not depend on this file or its contents.

...so that appears to be no longer relevant.

  • As of OS X 10.11.4 - fstab still actually works. It may not in future, but it still does at the moment. – Tetsujin Apr 25 '16 at 17:35
  • I wish El Capitan would go away in future releases. The message you posted sounds like a scarecrow. If fstab is no longer employed in future releases, something else will have to replace it. As far as I know, for now it is your only option. – David Anderson Apr 25 '16 at 18:31

1 Answers1

5

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, starts in command mode. To add a new line, 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 and press the return key.):

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

9) Type escape to return to command mode and then type ZZ 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.

Source

melMass
  • 272
  • Thanks. I was aware of the process for editing the fstab file, but had not done that because of the warning I described in my question. Since that warning still exists, it's still not clear whether making this change would be a good idea. – Tom Harrington Apr 11 '17 at 14:35
  • @TomHarrington ah sorry, i dont have the same message as you on the file, it just says "this file should only be edited using vifs" I have the same issue as you about using 2 macos on internal drives and I went the fstab way which works for me. I don't plan on upgrading to sierra soon so I'm not too concerned about it being unavailable in future releases. – melMass Apr 11 '17 at 14:35
  • Strange you would have a different message in the file. FWIW in Sierra the default file is called /etc/fstab.hd but has the same warning. – Tom Harrington Apr 11 '17 at 14:41
  • @TomHarrington It's a fresh install of 10.11.6 – melMass Apr 11 '17 at 14:58
  • 1
    instead of hfs write ntfs or any other type(bundle) that corresponds to your HDD as listed in diskutil – Vito Valov Nov 30 '18 at 13:46
  • Thank you @VitoValov. In my case replacing hfs with apfs was the missing piece of the puzzle (Mojave, 10.14.6). – flyingace May 31 '20 at 18:05