There are two boot partitions on my MacBook. A working, bootable, El Capitan is installed on both.

How can I prevent automounting partition2, when booting from partition1?

According to many pages I found via google this is done by editing fstab via vifs an adding the line

UUID=uuid_of_partition2_here       none    hfs     rw,noauto

But that doesn't work! The partition is mounted anyway!

  • idk if whitespace is important, I only have single spaces between those elements & mine works just fine to prevent my cloned boot drive from appearing. After that, maybe double/triple-check the UUID
    – Tetsujin
    Mar 21, 2016 at 9:52
  • @Tetsujin: changing each <tab> in the file to a single space solved the problem... if you write your comment as an answer I'll gladly mark it as the right one!
    – lexu
    Mar 21, 2016 at 10:46
  • Ah, glad it turned out to be a simple fix. I'll write it up as an answer...
    – Tetsujin
    Mar 21, 2016 at 10:52
  • I've got this chmod +x (executable) in my ~/bin/ directory. gist.github.com/voltechs/fc48c9683d50c7c03cab2f0a6477d8da
    – Volte
    Dec 30, 2017 at 22:22

6 Answers 6


It appears that the syntax must use single spaces, not tabs, to be recognised by the system.

This would fall in line with many command line processes; the only exception that springs to mind is the hosts file, which can use any amount of whitespace.

That would make the correct syntax

UUID=uuid_of_partition2 none hfs rw,noauto

rather than

UUID=uuid_of_partition2       none    hfs     rw,noauto

... subtle but important difference.

  • According to the manual page for fstab is states, "Each filesystem is described on a separate line; fields on each line are separated by tabs or spaces.". Note: I added the bold highlighting on the relevant part. Mar 21, 2016 at 12:19
  • Interesting - however, empirically, that seems to not be the case. Was that the man for Mac or nix?
    – Tetsujin
    Mar 21, 2016 at 12:20
  • As a test, I just modified my existing fstab file replacing spaces with tabs and then plugged in a drive that has three partitions, two of which are set not to mount. Only the first partition mounted, as it should have, and the two that are set not to mount did not mount, even with tabs being the field separator as stated in the manual page. Note that this is under OS X 10.8.5 and maybe things have changed in OS X 10.11. Mar 21, 2016 at 12:36
  • 1
    I've done some testing and will write up what I found in a separate answer.
    – lexu
    Mar 22, 2016 at 7:54
  • 1
    "no auto" should be a single word, "noauto" in the above examples. (they might be getting interpreted in a way that works as it is, but they're not correct)
    – Tom
    Jun 16, 2018 at 3:32

Tetsujin and user3439894's comments and observations prompted some testing.

Turns out, there is more than one UUID when you look at drives and partitions and the 'diskutil list' command doesn't report the UUID that needs to be used in the vifs/fstab commands.

  root %> diskutil info disk1 | grep -e UUID

Shows that there are Volume, Disk / Partition, LV,LVF and LVG UUIDs .. I'm only interested in the first two!

When I enter diskutil list I get the "Disk / Partition UUID", when I enter diskutil info disk1 I get both the "Disk / Partition UUID" and the "Volume UUID" (and more ..) I also get the "Volume Name" (the disk label)

Some tests I performed with the Volume - UUID and the disk label indicate:

  • the UUID in vifs/fstab is the "Volume UUID", don't use tabs!
  • the UUID command in vifs/fstab doesn't work with the "Disk / Partition UUID", tab/space makes no difference here
  • when using the "LABEL" syntax, don't use tabs!

Here are the two examples I got to work:

UUID=<Volume UUID><SPACE>none<space>rw,noauto

LABEL=<Volume Name><SPACE>none<space>rw,noauto

You can find the <Volume UUID> and the <Volume Name> of your internal disk by running

diskutil info disk1 | grep -e "Volume\ Name" -e "Volume\ UUID"

On my system the external disk-info shows up for disk2s1 and disk3s1

  • Nice bit of research. Would seem, though, that rather than trying to remember which can take tabs & which not, the safest method is to always use single spaces.
    – Tetsujin
    Mar 22, 2016 at 16:40
  • 1
    I agree .. but using tabs makes the elements line up, I tend to use them were ever I can get away with it (But not in vifs/fstab, apparently :-)
    – lexu
    Mar 23, 2016 at 9:43
  • 1
    These seem to be missing a field... The filesystem type (hfs, msdos, etc.) is supposed to follow the mountpoint (which is none in these examples). (See man fstab for the spec breakdown.)
    – Tom
    Jun 16, 2018 at 3:40

These are all great (and correct) answers!

I thought I'd share a small script/utility that I use to make this easier.

I've got this no_automount file executable in my ~/bin/ directory. (Don't forget to chmod +x it!)


#!/usr/bin/env ruby

# Usage: no_automount /Volumes/My\ Disk

diskinfo = `diskutil info '#{ARGV[0]}'`.gsub("\n\n", "\n").split("\n").collect do |b|

disk_uuid = diskinfo['Volume UUID']
disk_type = diskinfo['Type (Bundle)']
disk_name = diskinfo['Volume Name']

fstab_filename = '/etc/fstab'
text = File.read(fstab_filename)

new_contents = text.gsub(/UUID=#{disk_uuid}.*(:?\n)/, "")
new_contents << "UUID=#{disk_uuid} none #{disk_type} rw,noauto # #{disk_name}"

File.open(fstab_filename, "w") {|file| file.puts new_contents }

After using the script, if you sudo vifs you'll see something like this (mine looks like this).

# Warning - this file should only be modified with vifs(8)
# Failure to do so is unsupported and may be destructive.

UUID=51C2250E-9CE4-1953-8AF6-3EEDD46F594D none ntfs rw,noauto # Windows 10
UUID=7E55582C-6D91-4148-28C6-208D03071164 none ntfs rw,noauto # Windows Storage
UUID=CF294178-3B0D-4B23-AC72-24D10AAC6735 none ntfs rw,noauto # Windows Games
  • thanks, I'll look into this after the year end celebrations!
    – lexu
    Dec 30, 2017 at 22:49
  • I love answers with self running code❗️ That's self explaining 😄👍 Feb 6, 2019 at 5:00

Updated for macOS Mojave and macOS Catalina etc.

macOS Mojave 10.14 and later are more strict about editing system files.

Editing /etc/fstab is strongly discouraged. They now what you to use vifs. I have aggregated the info from other answers and created a bash oneliner that you can run and it will give you a list of UUID…noauto lines that you could add for each disk. Then you have to freedom to copy the line of your choice and then use sudo vifs and paste it in the file safely.

mount | sed -E '/\dev\/disk/!d; s/^([^ ]+)[^/]*([^(]+) \(.*/\1:\2/' | while read mount_info;  do echo -e "\n\nDisk ${mount_info%%:*} is mounted at ${mount_info##*:}" >/dev/stderr; sudo diskutil info ${mount_info%%:*} | grep UUID | tee /dev/stderr | printf '# To prevent auto mount of this disk, add the following line to `sudo vifs`\tUUID=%s none rw,noauto\n\n' $(sort| head -n1 | sed 's/.*: *//;s/ *//g;') | sed 's/.*UUID= .*/<no UUID found>/' | tr '\t' '\n'; done

That's a monster oneliner, I don't want to bore you with an explanation of what it does. (But if I get a request in the comments I will update this.)

Here is an example run:

$ mount | sed -E '/\dev\/disk/!d; s/^([^ ]+)[^/]*([^(]+) \(.*/\1:\2/' | \
  while read mount_info; do
    echo -e "\n\nDisk ${mount_info%%:*} is mounted at ${mount_info##*:}" >/dev/stderr;
    sudo diskutil info ${mount_info%%:*} | grep UUID | \
      tee /dev/stderr | \
      printf "$(echo \
        '# To prevent auto mount of this disk, add the following line' \
        'to `sudo vifs`\tUUID=%s none rw,noauto\n\n'
      )" $(sort| head -n1 | sed 's/.*: *//;s/ *//g;') | \
      sed 's/.*UUID= .*/<no UUID found>/' | \
      tr '\t' '\n'

Disk /dev/disk1s5 is mounted at /
   Volume UUID:               066AF3CD-C098-4D28-9C3A-AD6C53A443ED
   Disk / Partition UUID:     066AF3CD-C098-4D28-9C3A-AD6C53A443ED
# To prevent auto mount of this disk, add the following line to `sudo vifs`
UUID=066AF3CD-C098-4D28-9C3A-AD6C53A443ED none rw,noauto

Disk /dev/disk1s1 is mounted at /System/Volumes/Data
   Volume UUID:               760B55A4-3E55-4FFA-B22D-B48F0D227EEB
   Disk / Partition UUID:     760B55A4-3E55-4FFA-B22D-B48F0D227EEB
# To prevent auto mount of this disk, add the following line to `sudo vifs`
UUID=760B55A4-3E55-4FFA-B22D-B48F0D227EEB none rw,noauto

Disk /dev/disk1s4 is mounted at /private/var/vm
   Volume UUID:               B6011DF2-6391-4E5C-9A94-D73FF9AB51DC
   Disk / Partition UUID:     B6011DF2-6391-4E5C-9A94-D73FF9AB51DC
# To prevent auto mount of this disk, add the following line to `sudo vifs`
UUID=B6011DF2-6391-4E5C-9A94-D73FF9AB51DC none rw,noauto

Disk /dev/disk1s3 is mounted at /Volumes/Recovery
   Volume UUID:               14EDD79D-0EDA-42B0-A1C4-7B025159146B
   Disk / Partition UUID:     14EDD79D-0EDA-42B0-A1C4-7B025159146B
# To prevent auto mount of this disk, add the following line to `sudo vifs`
UUID=14EDD79D-0EDA-42B0-A1C4-7B025159146B none rw,noauto

Disk /dev/disk2s1 is mounted at /Volumes/Install macOS Mojave
   Volume UUID:               B14957BD-83D2-3A36-A828-89CF03C7F45A
# To prevent auto mount of this disk, add the following line to `sudo vifs`
UUID=B14957BD-83D2-3A36-A828-89CF03C7F45A none rw,noauto

Disk /dev/disk3s2 is mounted at /Volumes/TM Backup
   Volume UUID:               5E0A580C-2894-3529-9B52-3E33BD10DF53
   Disk / Partition UUID:     22D06480-5187-48BD-9079-D95D34B0494E
# To prevent auto mount of this disk, add the following line to `sudo vifs`
UUID=22D06480-5187-48BD-9079-D95D34B0494E none rw,noauto
  • Cool idea - but sadly on my system (macOS 10.15.5) this only outputs one entry even though there are 7 volumes mounted.
    – stef
    Jun 6, 2020 at 0:33
  • @stef if you will share either a gist or a pastebin of the output of ‘mount’ on your system, I’ll my answer to work for 10.15.5 also. If SO won’t let you share the link just drop the name of the service and the hash. I got you. Jun 6, 2020 at 0:55
  • @stef, are running zsh instead of bash? Oddly it only outputs the first disk in zsh. I haven't figured out why exactly yet, but it works correctly in bash. Just run bash and then run the oneliner!
    – Chris
    Jun 22, 2020 at 0:04
  • @BrunoBronosky you might consider tweaking your onliner to work in zsh since it's the new default in Catalina and beyond. I haven't yet figured out why it only outputs the first line in zsh, though I'm sure the answer will be fascinating.
    – Chris
    Jun 22, 2020 at 0:05
  • @Chris yes sir, zsh as is default with Catalina. Trying to move with the times. I sent Bruno the output of my system, maybe it's useful tracing the discrepancy.
    – stef
    Jun 22, 2020 at 1:15

On OS X 10.11.6 Whitespaces vs Tabs did not matter for me (confirmed I was using "true" tabs by viewing /etc/fstab in a hex editor and observed 0x09 for field separator byte).

I did use vifs, however, but from what I can tell that simply locks file access to /etc/fstab. Also tested with a leading newline (blank line) under file comment as well as last line of fstab containing no newline or newline (blank line under last fstab entry)

The main thing that mattered for me was:

  1. Use Volume UUID instead of Disk / Partition UUID
  2. Specifying filesystem type is crucial (lexus example lacked this)

Untested factors:

  1. no auto vs noauto (I used noauto)
  2. Text editor configured to use multiple spaces for tabs
  • 1
    Could you please expand on the 'filesystem type'. Where do I specify that? Do you know of documentation for this topic?
    – lexu
    Jul 26, 2016 at 6:44
  • man fstab lists supported filesystems as well as describes various expected "tokens" (keywords). I only posted because it seemed like the behavior of fstab was broken for awhile on El Capitan, but seems to work as expected / documented as of OS X 10.11.6. Jul 27, 2016 at 4:50

The command contains a file system type to be mounted. Make sure that if you are not mounting an apple drive which is hfs, substitute this for your type, for example ntfs if its newer windows disk.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .