4

I don't want my BootCamp partitions automatically mounted on boot.

For the main windows partition this can be accomplished by putting the UUID into fstab.

# /etc/fstab
# https://gist.github.com/968327
# You can find the volume UUID in Disk Utility. Select the volume on the left
# and then File->Get Info. See "Universal Unique Identifier".
#
# Options used below:
#  ro for readonly (can be omitted)
#  noauto to prevent auto-mount
#  noatime to skip writing last access times (performance thing, optional)
#
# Remember to set the filesystem type (hfs, ntfs, etc) too
##########
# BOOTCAMP
UUID=BCC6AB78-5605-4102-B4CE-D2CF9C3D2BDB     none     ntfs     ro,noauto,noatime
LABEL="SYSTEM RESERVED" none    ntfs    ro,noauto,noatime

But, as you see, I tried to prevent 'System Reserved' from mounting as well. Unfortunately it doesn't work with a UUID, because it doesn't have one. The LABEL option doesn't seem to work on OSX either.

4 Answers 4

1

I found this forum post which has a couple options:

The straightforward way is to create a login applescript, replacing /Volumes/Windows with your path:

tell application "Finder"
    if (exists the disk "Windows XP") then
        do shell script ("hdiutil unmount /Volumes/Windows\\ XP -force")
    end if
end tell

Another way is to modify /private/etc/rc.local to add:

disktool -u disk0s3

If you have more than one disk, or have formatted it into more than just a MacOS and Windows volume, you will have to use Disk Utility or something to determine the Disk Number (in this case 0) and Partition Number (in this case 3) of your Windows volume.

1
  • 1
    I accept this answer, although I'd rather prefer one which really prevents the disk from being mounted in the first place. Going the rc.local route, I added diskutil unmountDisk "System Reserved" to the file. This helps in the case I'd swap drives in my MacPro.
    – urandom
    Commented Jul 12, 2011 at 17:23
6

Your original solution using /etc/fstab will work, but you must use the volume's UUID (which DOES exist, Disk Utility just doesn't display it for NTFS formatted partitions- thanks Apple...) To learn the UUID use the following command in terminal:

diskutil info /dev/diskXsY ##substituting the X & Y for the disk and partition designation of the volume you want NOT to be mounted- which you can learn with: diskutil list

For this command to succeed and show you the UUID you can not have Tuxera NTFS enabled for that partition. If you are using that or probably any other non-native file system drivers for NTFS, you must disable them (at least for that partition) and reboot. The partition must also either be mounted or dismounted when you run the command- I can't remember which (and I remember that for me it actually turned out to be the opposite of what I found posted on a forum somewhere... so experiment).

If for some reason you just can't get OS X to show you the UUID you can resort to booting up with an Ubuntu installation disk and using a tool like gparted (there are quite a few ways using either the command line or a GUI app- you won't have trouble finding more information on that). You don't have to worry, the UUID will be the same between operating systems.

Then add the following line to /etc/fstab

UUID=(you know what to put here- no enclosing brackets or anything) none ro,noauto 0 0

reboot and voila- no unwanted partitions mounted! This is a system wide setting for all users, but you can still mount the partition using the Disk Utility.

This is the most pervasive and effective solution to this problem- plus it's not broken if you happen to move the disk to another controller or port, or even if you change the volume's label. However, formatting the partition will assign it a new UUID.

1
  • 1
    The man file for fstab specifies the third column should be the filesystem type and the two zeros at the end are defaults. As a result, I'm using: UUID=(you know what to put here- no enclosing brackets or anything) none ntfs ro,noauto
    – BrezzaP
    Commented Mar 10, 2013 at 9:22
3

In Mac OS Catalina 10.15.7 and above, you SHOULD NOT Edit the fstab entry directly. Instead you should use vifs with sudo. To accomplish what the original post is requesting in MacOS Catalina and above, you should take the following steps.

  1. Open your terminal app
  2. Type diskutil list
  3. Note the disk volume of your bootcamp partition, i.e. /dev/disk0s3
  4. Next find the Volume UUID of your bootcamp partition by typing diskutil info /dev/diskXsY where X is your disk and Y is your bootcamp partition. i.e. diskutil info /dev/disk0s3
  5. The result will return information of Type (Bundle): ntfs and Volume UUID: XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
  6. Note both of those paramaters, and copy the Volume UUID into your clipboard.
  7. Type sudo vifs and enter your password
  8. Once in vifs, type 'a' and hit enter.
  9. Create a new line on the bottom of the page.
  10. Copy and paste this EXACTLY as it is printed here replacing the UUID with your UUID that you copied in step 6:
# Forbid Mounting of Bootcamp volume at boot by uncommenting the line below
UUID=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX none ntfs ro,noauto
  1. Press escape, then hold shift and type zz to save the file.

  2. Bootcamp will now be properly forbidden from automounting at MacOS Boot.

0

DanRan: It worked for me! Thank you very much. I was confused when it came to pasting the UUID. Instead of pasting over my highlight, it pasted to the end of the line. I did some deleting and pasting and it worked.

3
  • Welcome to Ask Different! Please don't add "thanks" as answers. Invest some time in the site and you will gain sufficient privileges to upvote answers you like, which is the Ask Different way of saying thank you.
    – agarza
    Commented Jul 14 at 22:29
  • Thanks agarza. It looks like this site isn’t for me because I definitely do not have time to invest in that kind of activity. Thank you for the correction.
    – theorivas
    Commented Jul 15 at 23:10
  • It's really not the much. The privilege to up-vote is 15 pts. If you have at least questions or answers that get upvoted, then you can start upvoting.
    – agarza
    Commented Jul 15 at 23:19

You must log in to answer this question.

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