Prevent BootCamp partition from automatically mounting

bootcampmount

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.

Best Answer

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.