desktop drive icons

With the exception of partitions in unreadable formats and certain hidden partitions such as EFI and Recovery HD, the default behaviour of macOS is to mount all partitions of a drive on boot-up, login, or on connecting an external drive.

Whilst this behaviour is useful for the novice or for those connecting a single USB stick to copy some files, it can become unwieldy and even annoying if you have many multi-partitioned drives attached to your Mac.

For example, my desktop Hackintosh has three internal drives, each with at least two partitions, and one of these drives is not even needed when booted under macOS – it is for Windows 10 and Linux. Add to this a couple of external hard drives with partitions for storage, OS installers and Time Machine backups for other computers, and your desktop and Finder sidebar can begin to look a real mess. It also takes time for the drives to mount on every boot and unmount on sleep or shutdown.

This guide will detail how to ensure only the drives of your choosing mount automatically, leaving the rest unmounted within macOS.

1) To prevent partitions from mounting automatically we are going to add their UUIDs to a list via Terminal. First, connect the drives and mount the partitions which you do not want to mount automatically in future.

2) Next, launch Terminal (found in /Applications/Utilities, or with Spotlight). At the prompt, paste the command:

diskutil info /Volumes/"Volume Name" | grep 'Volume UUID'

Replace “Volume Name” with the name of the partition you want to stop from mounting, making sure to retain the speech marks if your volume name contains spaces or punctuation.

It will return a string titled “Volume UUID”.

3) Copy this long string and paste it somewhere, then repeat the command for all the other partition names you want, pasting their UUIDs somewhere safe too.

volume UUID strings

4) Once this is done, in Terminal, type:

sudo vifs

5) Enter your administrator password when prompted. An empty editable document will then appear in the Terminal window. Press the “A” key to bring up the cursor and, using the “Down Arrow” key and a final press of the “Enter” key, navigate down the document to below the lines marked with the # symbol, and above the lines marked with the ~ symbol.

Now copy and paste the following line into the document:


Replace the string of Xs with your own UUID which you noted earlier. Add any further partitions on the lines below, repeating the entire phrase but changing the Xs each time.

prevent drives from mounting on mac

6) When you’ve finished, press the “esc” key to exit cursor mode, then type “:x” and hit the “Enter” key to save your changes and exit the document.

After a reboot, logout/login, or disconnect/reconnect of the drives, the partitions you have added to the document should not automatically mount. If you wish to mount those partitions in future, you can use Disk Utility or Terminal to do it manually.

In order to reverse the changes described here you can remove the UUIDs of your drives from the /etc/fstab file which we added them to, using a similar process as before. First, open Terminal and issue the “sudo vifs” command. Enter your password to view /etc/fstab with your list of drives inside. Press “A” to enter edit mode, navigate down to your inserted lines with the “Down Arrow” key, and use the “Delete” or “Backspace” key to remove as many of them as you like. When finished, press “esc” to leave edit mode, then type “:x” and press the “Enter” key to save changes and exit the editor.

This method will work with normal, RAID, encrypted and CoreStorage partitions. The command given in this guide assumes the partition in question is formatted jhfs+ (Mac OS Extended Journaled), and that you wish it to be read-write on mount. Most macOS partitions are formatted in this way, but you can check the formatting of your drive in the Disk Utility application if you are unsure. If your partitions are set up differently, you must edit the command accordingly.

For example, if you did want the partition to mount automatically, but wanted it to be mounted as read-only instead of read-write, you could remove the phrase “noauto”, and replace “rw” with “ro”.

To set a partition that is formatted as FAT to not automatically mount, replace “hfs” in the above command with “msdos”.

Other file type commands are available, look up the ones you need if they are not mentioned here. I have verified this guide as working from OS X 10.7 – macOS 10.12.

As a final note, many guides suggest using this command to edit the file:

sudo nano /etc/fstab

Although I have used this command myself and it works well, it is not recommended by Apple as completely safe. As detailed, Apple recommends always using the “vifs” tool instead.

Please let me know if you found this useful below, or if you have any questions or problems regarding the process. Happy mounting!


  • Ed Hainsworth

    Are the um-mounted drives still available for things like TM backup?

    • Joaquim Barbosa

      Hi Ed!

      No, the unmounted drives will not be available for tasks such as Time Machine backups, as they are not visible to the OS at all. They would have to be manually mounted for the system, and TM, to see them. They are essentially in a state like when you eject a USB stick from the Desktop, but have not physically disconnected it from the USB port.

      I envisage this process being used mainly for partitions which are not needed at all regularly, unlike TM which is constantly accessed. Examples such as Windows partitions, macOS installer partitions, and Time Machine disks belonging to computers OTHER than the one you are working on would seem to be classic candidates for this process, to stop the clutter.

      Thanks for the question, I hope the guide will be useful to you!


      • Ed Hainsworth

        I figured as much, thanks for the update. It would be nice to have a dedicated TM drive and have it “invisible”.

      • Joaquim Barbosa

        If that’s something you’d be interested in I can certainly look into it for you, though I haven’t heard of it before now.

        As an interim measure, drives can be prevented from showing on the desktop by going to Finder, Preferences, and unticking the box marked “Show these items on the desktop… External drives”. However, this will hide all drives from the desktop, not just the TM.

        Drives can be hidden from the Finder sidebar from the same preferences window, under the heading “Sidebar”.

        In both these cases, the drives will remain mounted, but not show in those respective locations, however, both lack drive-by-drive granularity.

        You’re right that it would be good to have finer control over it, I’ll take a look and see…

      • Joaquim Barbosa

        Ed, apparently the following command can be used to hide the drive from Finder:

        SetFile -a V “/Volumes/Time_Machine_drive_name”

        Issue it from the Terminal, replacing “Time_Machine_drive_name” with the name of your drive. Then run:

        killall Finder

        To restart Finder and apply the changes. Bear in mind, I haven’t had time to test this yet myself, so use caution, though I can’t imagine it would cause much harm. To revert, issue:

        SetFile -a v “/Volumes/Time_Machine_drive_name”

        If you give it a go, please let me know if it worked and on which OS you tried it.

        Good luck!

  • igobythisname

    awesome post! i have some questions if anyone can help I GREATLY appreciate it! i have a windows PC, I have about 4-5 SATA hard drives connected. last weekend i tried and tried to install Mac OS X/Hacintosh on my PC but all my efforts were unsuccessful. i ended up re-installing Windows 10 and everything is back to normal -with the exception that all my hard drives now appear in the little remove connected device thing down in the system tray; like when i connect a USB flash drive, when i go to eject it, all my hard drives appear there -they never did before! did me trying to hackintosh my PC “mount” all my hard drives? if so, how can I reverse this, so they don’t appear in the remove device system tray icon feature? THANKS IN ADVANCE!!!!

    • Joaquim Barbosa

      Hi there,

      I’m not sure I’ll be able to help with this problem without a lot more information as to what changes you made whilst trying to hackintosh your PC. Did you change any BIOS settings by any chance?

      If “hot-swapping” is turned on in the BIOS for your internal SATA drives, it can make them appear as external/ejectable sometimes.

      If you didn’t then I’m not sure; it could be many things causing the behaviour. Out of interest, what parts does your PC have, that you were trying to hackintosh?

      Thanks for reading,

  • MacMike

    FYI, this tip helped me hide the Recovery HD that decided to start showing up on my desktop recently. Once hidden it still works as a recovery drive.

    Thanks for the post!