PDA

View Full Version : [How To] Prevent a partition from mounting at boot


Voyn1x
03-22-2008, 10:41 PM
This tutorial is great for keeping your desktop tidy by unmounting drives you don't need regular access to. For example this could be your Windows drive, Tiger partition etc. I thought this could be added to the wiki, i'm sure others would find this useful :)

First get the UUID of a volume you wish to stop mounting - this can be seen in Disk Utility (click the Info button and find the Universal Unique Identifier).

Now that you have a UUID for the volume to hide during the mount process, from an admin account create your /etc/fstab file (in Leopard this file doesn't exist by default):

From Leopard on you need to use vifs to create and edit /etc/fstab, or at least you should*.

sudo vifsAdd a line with the UUID for your volume and the mounting point information, for example:

# Identifier, mount point, fs type, options
UUID=F0E430C1-5558-3BB3-9FA9-6904B663FEEA none hfs rw,noautoThe Identifier is used to identify the volume.

The mount point is the directory used when the volume is mounted; set none to use the pre-defined OS X directory, i.e. ./Volumes/

The fs type describes the type of the filesystem; use hfs for a Mac volume, use ntfs if it's a NTFS formatted PC volume. The field options describes the mount options associated with the filesystem. 'noauto' will force the volume not to be mounted automatically; and last, use 'rw' or 'ro' for a read-write or read-only disk.

One thing to note is that FAT32 and NTFS formatted volumes are not assigned a UUID. You'll have to use LABEL instead of UUID and change the fs type to 'msdos' or 'ntfs'. NTFS volumes are mounted read only under os x, so you'll also have to change the option from 'rw' to 'ro'.

eg.

FAT32LABEL=<drive name> none msdos rw,noautoNTFSLABEL=<drive name> none ntfs ro,noautoSave the file and reboot (for internal drives) or unmount, disconnect and reconnect the volume (for external drives). Now the system should not mount the partition identified in fstab. You can still manually mount the volume in Disk Utility, or via the command line (and for a volume containing a boot system, rebooting from it).

Also, you might find that /etc/fstab is ignored and your partition still mounts. Two things you can try:*


sudo defaults write /Library/Preferences/SystemConfiguration/autodiskmount AutomountDisksWithoutUserLogin -bool true
Instead of using "none" for the mountpoint use the normal location i.e. /Volumes/WindowsXP along with the ro,noauto options.

agrafuese
03-25-2008, 02:07 AM
Hey good tip. I used to do this when I had other drives in my system, but I never knew about the UUID method. I only ever used the name of the volume in the command, but that's not as good because it could always change (accidentally or intentionally). It's also a hassle because you have to type in space characters if your volume name has a space in it. Thanks.

roisoft
03-25-2008, 02:13 AM
you can use "boot uuid=xxxx-xxx-xxxx..." like an kernel flag in boot.plist for boot leopard from a software raid for example.

bhast2
03-25-2008, 02:59 AM
can you do this if you have leopard and vista on the same hd

agrafuese
03-25-2008, 03:22 AM
Unmounting at startup? Yes.

bhast2
03-25-2008, 06:16 AM
so where is the uuid number because i can't find it for my windows partition???

cause this is all it show in disk utility
Name : disk0s2
Type : Volume

Disk Identifier : disk0s2
Mount Point : /Volumes/Untitled
File System : Windows NT Filesystem 3G
Connection Bus : ATA
Device Tree : /PCI0@0/SAT1@8/PRI0@0/@0:2
Writable : Yes
Capacity : 100.7 GB (108,162,580,480 Bytes)
Free Space : 69.6 GB (74,690,961,408 Bytes)
Used : 31.2 GB (33,471,614,976 Bytes)
Number of Files : 81,378
Number of Folders : 0
Owners Enabled : Yes
Can Turn Owners Off : No
Can Repair Permissions : No
Can Be Verified : Yes
Can Be Repaired : Yes
Can Be Formatted : Yes
Bootable : No
Supports Journaling : No
Journaled : No
Disk Number : 0
Partition Number : 2

Ianxxx
03-25-2008, 06:21 AM
you have to click on menu at top of screen, then file, then get info

bhast2
03-25-2008, 06:34 AM
that is what i am clicking and that is what it shows
ok it will show it for my leopard partition but there isn't one for my windows partition
Leo partition
Name : Leo
Type : Volume

Disk Identifier : disk0s3
Mount Point : /
File System : Mac OS Extended (Journaled)
Connection Bus : ATA
Device Tree : /PCI0@0/SAT1@8/PRI0@0/@0:3
Writable : Yes
Universal Unique Identifier : CBA0AF8F-B8BE-37BF-B765-78C3C0CAF3D9
Capacity : 197.0 GB (211,566,379,008 Bytes)
Free Space : 183.7 GB (197,253,259,264 Bytes)
Used : 13.3 GB (14,313,119,744 Bytes)
Number of Files : 380,148
Number of Folders : 93,242
Owners Enabled : Yes
Can Turn Owners Off : Yes
Can Repair Permissions : Yes
Can Be Verified : Yes
Can Be Repaired : Yes
Can Be Formatted : Yes
Bootable : Yes
Supports Journaling : Yes
Journaled : Yes
Disk Number : 0
Partition Number : 3

windows partition
Name : disk0s2
Type : Volume

Disk Identifier : disk0s2
Mount Point : /Volumes/Untitled
File System : Windows NT Filesystem 3G
Connection Bus : ATA
Device Tree : /PCI0@0/SAT1@8/PRI0@0/@0:2
Writable : Yes
IT SHOULD BE RIGHT HERE BUT IT IS MISSING
Capacity : 100.7 GB (108,162,580,480 Bytes)
Free Space : 69.6 GB (74,690,961,408 Bytes)
Used : 31.2 GB (33,471,614,976 Bytes)
Number of Files : 81,378
Number of Folders : 0
Owners Enabled : Yes
Can Turn Owners Off : No
Can Repair Permissions : No
Can Be Verified : Yes
Can Be Repaired : Yes
Can Be Formatted : Yes
Bootable : No
Supports Journaling : No
Journaled : No
Disk Number : 0
Partition Number : 2

Ianxxx:you have to click on menu at top of screen, then file, then get info

Ianxxx
03-25-2008, 06:36 AM
On partition not drive
Strange comes up between Writable : Yes
and
Capacity : 100.7 GB (108,162,580,480 Bytes)

Ianxxx
03-25-2008, 06:42 AM
try in terminal
diskutil info diskXsY

bhast2
03-25-2008, 06:43 AM
look at my above post i put in bold where it should be compared with my leo partition ^^^^^

bhast2
03-25-2008, 06:45 AM
this is what it shows in terminal
bill-hasts-macpro31:~ billhast$ diskutil list
/dev/disk0
#: TYPE NAME SIZE IDENTIFIER
0: GUID_partition_scheme *298.1 Gi disk0
1: EFI 200.0 Mi disk0s1
2: Microsoft Basic Data 100.7 Gi disk0s2
3: Apple_HFS Leo 197.0 Gi disk0s3
/dev/disk1
#: TYPE NAME SIZE IDENTIFIER
0: FDisk_partition_scheme *186.3 Gi disk1
1: Apple_HFS Stuff 186.3 Gi disk1s1
bill-hasts-macpro31:~ billhast$ diskutil info disk0s2
Device Identifier: disk0s2
Device Node: /dev/disk0s2
Part Of Whole: disk0
Device / Media Name: Untitled

Volume Name:
Mount Point: /Volumes/Untitled
File System: NTFS-3G

Partition Type: Microsoft Basic Data
Bootable: Is bootable
Media Type: Generic
Protocol: ATA
SMART Status: Verified

Total Size: 100.7 Gi (108162576384 B) (211255032 512-byte blocks)
Free Space: 69.6 Gi (74690961408 B) (145880784 512-byte blocks)

Read Only: No
Ejectable: No
Whole: No
Internal: Yes

bill-hasts-macpro31:~ billhast$

Still not there how can the be it should have a uuid number right

Ianxxx
03-25-2008, 06:45 AM
don't know then guess it doesn't have one lol!

Ianxxx
03-25-2008, 06:47 AM
NTFS-3G
wonder if this is the cause?
I gather you installed macfuse

bhast2
03-25-2008, 06:48 AM
but it should right???

bhast2
03-25-2008, 06:48 AM
Yea i sure did and it works great

Ianxxx:NTFS-3G
wonder if this is the cause?
I gather you installed macfuse

Ianxxx
03-25-2008, 06:50 AM
well I can only think that that is the cause, can you not use the partition name, I think someone suggested that in this thread.

bhast2
03-25-2008, 06:51 AM
i could try it thanks for the tip

agrafuese
03-25-2008, 08:38 AM
yeah that'll work for ya bhast. just make sure you don't accidentally rename your partitions at any point otherwise they'll pop up again ;) if you have spaces in the names too, post back in here and i'll let you know how to handle that (i'm blanking at the moment, but i can look it up). good luck.

Voyn1x
03-25-2008, 10:55 PM
Oops yep forgot to say FAT32 formatted volumes are not assigned a UUID. You'll have to use LABEL instead of UUID and change the fs type to 'msdos'.

eg. LABEL=WINDOWSXP none msdos rw,noauto 0 0

'WINDOWSXP' is replaced with your drive name. :)

Dies
09-18-2008, 07:53 PM
Yes, just using labels is much easier to wrap your head around, easier to set and easier to remember. UUID must have some advantages over labels since everything is moving in that direction but I haven't found them yet.

Two things I found out while excluding my Windows partition from mounting. Thought maybe they could be added to the first post so others don't have to go searching?

From Leopard on you need to use vifs to create and edit /etc/fstab, or at least you should.

sudo vifs
Also, you might find that /etc/fstab is ignored and your partition still mounts. Two things to try

sudo defaults write /Library/Preferences/SystemConfiguration/autodiskmount AutomountDisksWithoutUserLogin -bool true
Instead of using "none" for the mountpoint use the normal location i.e. /Volumes/WindowsXP along with the ro,noauto options.

Also, MacFUSE/NTFS-3G is awesome, a little slow compared to the normal NTFS-3G but still.

Voyn1x
09-18-2008, 09:05 PM
Cheers Dies i didn't know about vifs. Guide updated. :)

zuz242
10-17-2008, 10:51 PM
From Leopard on you need to use vifs to create and edit /etc/fstab, or at least you should]

Well, nice tutorial but it took me a while to get vifs to do what i wanted.
I had no idea of the commands used in the vi(fs) editor. Google helped ;)

But maybe you could add the 3 commands for vi in your tut.
"i" for insert mode,
"esc" for switching back to command mode
":wq" for saving

Aydinz
10-30-2008, 07:50 AM
can the label option be used for NTFS as well? because one of my NTFS drives doesnt have a UUID. and also just so im clear i enter "sudo vifs" into terminal put in the label commands to unmount the disks then type is :wq to save the file and then reboot my system and it should all work?

Voyn1x
10-30-2008, 02:24 PM
Label will work, but you'll also need to change the fs type to ntfs:

LABEL=name_of_volume none ntfs ro,noautoI'm going to update the first post with this. :)

scififan68
10-31-2008, 03:30 AM
Can I use this tutorial for a Fat16 partition? :)

Aydinz
10-31-2008, 06:31 AM
how do i save the command after i have written in what i want?

nfoav8or
10-31-2008, 06:50 AM
1. shift+"i" to insert/edit text.
2. edit
3. esc to quit the editing/insertion.
4. ":s /etc/fstab" to save over the old fstab.

do it in this order.

demigod
01-09-2009, 12:56 PM
i added LABEL=WinXp /Volumes/WinXp/ ntfs rw,noauto 0 0
this in /etc/fstab using sudo vifs and also executed this "sudo defaults write /Library/Preferences/SystemConfiguration/autodiskmount AutomountDisksWithoutUserLogin -bool true" in terminal still it's not unmounting it automatically..

what should i do to unmount it automatically.

Voyn1x
01-09-2009, 02:22 PM
Have you tried using none for the mount point?

demigod
01-09-2009, 08:06 PM
Have you tried using none for the mount point?

yup i tried it ..

Dies
01-09-2009, 10:31 PM
demigod

Can you post the output from

diskutil list

Also, is there a reason you have "rw" in your fstab options? Does this mean you have NTFS-3G installed? If so, you need to make the filesystem type in fstab "ntfs-3g" and not simply "ntfs".

Also make sure you have an empty line at the end of fstab.

Voyn1x
01-09-2009, 10:36 PM
Try setting the drive to read only as it's ntfs. Also i've removed the zeros as they're not meant to be there, oops (i've updated the first post) :o:

LABEL=WinXp none ntfs ro,noauto[Edit] Follow dies instructions if you've got ntfs-3g installed, but still remove the zeros

demigod
01-10-2009, 04:17 AM
demigod

Can you post the output from

diskutil list

Also, is there a reason you have "rw" in your fstab options? Does this mean you have NTFS-3G installed? If so, you need to make the filesystem type in fstab "ntfs-3g" and not simply "ntfs".

Also make sure you have an empty line at the end of fstab.

diskutil list

/dev/disk0
#: TYPE NAME SIZE IDENTIFIER
0: FDisk_partition_scheme *74.5 Gi disk0
1: Apple_HFS Mac HD 74.5 Gi disk0s1
/dev/disk1
#: TYPE NAME SIZE IDENTIFIER
0: FDisk_partition_scheme *149.0 Gi disk1
1: DOS_FAT_32 WinXp 47.8 Gi disk1s1
2: Apple_HFS Storage 101.2 Gi disk1s5

i forgot to mention that i have NTFS-3G installed.Let me try "ntfs-3g" option

why WinXp is marked as DOS_FAT_32 partition ? it is a NTFS type

demigod
01-10-2009, 04:26 AM
demigod

Can you post the output from

diskutil list

Also, is there a reason you have "rw" in your fstab options? Does this mean you have NTFS-3G installed? If so, you need to make the filesystem type in fstab "ntfs-3g" and not simply "ntfs".

Also make sure you have an empty line at the end of fstab.

Try setting the drive to read only as it's ntfs. Also i've removed the zeros as they're not meant to be there, oops (i've updated the first post) :o:

LABEL=WinXp none ntfs ro,noauto[Edit] Follow dies instructions if you've got ntfs-3g installed, but still remove the zeros

Thank you both it worked out.i followed Dies and Voynx method