Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

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.

share|improve this question

2 Answers 2

up vote 1 down vote accepted

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.

share|improve this answer
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 Jul 12 '11 at 17:23

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.

share|improve this answer
    
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 –  Brent Plump Mar 10 '13 at 9:22

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.