Pick of the Week - Nov 10 [Show all picks]
Path Finder 5 - A feature-laden Finder replacement
Submit Hint Search The Forums LinksStatsPollsFAQHeadlinesRSS
12,000 hints and counting!

Prevent a given partition from mounting at boot System
I have an external hard disk with two partitions on it: a principal partition is used for all my stuff (apps, games, user file, music, etc.), and a secondary partition with a minimal OS X installation, containing some diagnostic and recovering software utility, that I periodically use for backup and testing purposes.

The principal partition is obviously always active, but ideally the secondary partition would be inactive or hidden on boot, so that it no longer appears on my desktop and would be manually actived when needed (with Disk Utility, the command line or via a automated backup script). For example, I know that TechTool Pro does something similar and calls such partition "eDrive."

There are several hints on this site for unmounting a partition at login, but a better way to make this happen can be used. You need to create an entry point in your filesystem table to tell the OS not to mount that specific volume, and this is relatively easy. In Mac OS X, and under Linux and others unix systems, the volume mounting configuration file is located in /etc/fstab. This file in Mac OS X Tiger is empty (in Panther, it's commented), but type man fstab in Terminal to read some important information.

Read on for my solution...

An /etc/fstab example:
 # Identifier,  mount point,  fs type,  options1
 UUID=DF000C7E-AE0C-3B15-B730-DFD2EF15CB91  /export  ufs    ro
 UUID=FAB060E9-79F7-33FF-BE85-E1D3ABD3EDEA  none     hfs    rw,noauto
 LABEL=This40Is40The40Volume40Name  none     msdos  ro
The Identifier is used to identify the volume; the LABEL is the volume name, the UUID is the Universal Unique Identifier Drive. You can use both, but the UUID is the best choice because renaming the volume will not change this identifier.

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. The field options describes the mount options associated with the filesystem. The option auto will mount the volume in the normal way, noauto will force the volume not to be mounted automatically; and last, use rw or ro for a read-write or read-only disk.

The UUID of a volume can be seen in Disk Utility (click the Info button and find the Universal Unique Identifier), or in Terminal using this command:
diskutil info /path/to/disk
In Mac OS X Panther, Disk Utility and the diskutil command doesn't display the UUID value. But if you look in the system.log file, when the disk is mounted, you can see something similar to this (line breaks added for narrower display):
 ... localhost diskarbitrationd[87]: disk1s9   hfs  
   77F3E84D-E0ED-3194-96A5-BED10893FFF4  FireWire HD    
   /Volumes/FireWire HD<br>
  ... localhost diskarbitrationd[87]: disk1s10  hfs  
   F0E430C1-5558-3BB3-9FA9-6904B663FEEA  Mac OS X Disc 
   /Volumes/Mac OS X Disc
The string before the volume name is the UUID for the disk.

Now that you have a UUID for the volume to hide during the mount process, from an admin account edit your /etc/fstab file:
 sudo pico /etc/fstab/
Add a line with the UUID for your volume and the mounting point information, for example:
 UUID=F0E430C1-5558-3BB3-9FA9-6904B663FEEA  none  hfs  rw,noauto
Save 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).

[robg adds: I haven't tested this one, and would recommend having a good backup before proceeding if you're going to do so.]
    •    
  • Currently 0.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (0 votes cast)
 
[48,589 views]  

Prevent a given partition from mounting at boot | 24 comments | Create New Account
Click here to return to the 'Prevent a given partition from mounting at boot' hint
The following comments are owned by whomever posted them. This site is not responsible for what they say.
Prevent a given partition from mounting at boot
Authored by: AquaX on Tue, Oct 10 2006 at 8:11AM PDT
Worked nicely for me on my MacBook Pro with one partition of my firewire external drive.

The only minor issue I noticed is that the hint says to edit "/etc/fstab/" and you should be editing "/etc/fstab".



[ Reply to This | # ]
Prevent a given partition from mounting at boot
Authored by: Allan Doyle on Tue, Oct 10 2006 at 10:15AM PDT

This is a great hint, it's finally showed me how to do the opposite of what you were trying to do... I've been trying to figure out how to get external Firewire drives to mount even if no one is logged in to the Mac...

I just grabbed all the UUIDs from my various drives and made entries like

UUID=922AD32A-308F-332B-876D-57C5F9CE2EDD none hfs rw,auto
UUID=2D38EBA3-0776-33AB-87CB-AFCE63BBFE44 none hfs rw,auto
UUID=E2C8C41F-5F51-3DC7-AE05-4A15AE853A45 none hfs rw,auto
UUID=CC346AF2-DCAD-31DC-B01C-B58996BADC25 none hfs rw,auto
one per partition. They all mounted just fine. The first is an entire 250 GB drive, the other three are all partitions of a second 250 GB drive.



[ Reply to This | # ]
Prevent a given partition from mounting at boot
Authored by: jolinwarren on Wed, Oct 11 2006 at 2:38AM PDT
Actually, there's a better way to automount drives even if no one is logged in. The method in the hint below doesn't require you to update anything if you use a new partition with a new UUID.

A fix for local drives not mounting until user login

I can confirm that the hint works on 10.4 (Tiger).

[ Reply to This | # ]
Prevent a given partition from mounting at boot
Authored by: derekhed on Wed, Oct 11 2006 at 1:46PM PDT
Hey! You have the same UUID as me! :-)

[ Reply to This | # ]
Prevent a given partition from mounting at boot
Authored by: transeau on Tue, Oct 10 2006 at 11:00AM PDT
a little more complicated than it needs to be...

I did this;

Add to the end of /etc/rc (before the "exit")

diskutil unmount /Volumes/Windows
diskutil unmount /Volumes/Windows\ Data



[ Reply to This | # ]
Prevent a given partition from mounting at boot
Authored by: gorefest on Tue, Oct 10 2006 at 11:39AM PDT
more clean would be putting this in /etc/rc.local ... ;)


[ Reply to This | # ]
Prevent a given partition from mounting at boot
Authored by: AquaX on Tue, Oct 10 2006 at 4:11PM PDT
The added benefit of the original hint is that the drive won't mount, even if you're just connecting the external drive without rebooting.

Quite useful for my situation, because my MBP is on and off my desk 2 to 3 times a day, with no restarts between.

[ Reply to This | # ]
Prevent a given partition from mounting at boot
Authored by: xSmurf on Wed, Apr 18 2007 at 8:33PM PDT
This used to work great (I use rc.local though), but recently it stoped working. According to my logs, the drive isn't yet mounted when rc.local executes. Any ideas?

---
MacBook Pro 2.16Ghz / 2Gb / 100Gb 7200rpm / CD/DVD±RW
PM G4 DP 800 / 1.25gb / 120Gb+80Gb / CD/DVD±RW/RAM/DL
- The only APP Smurf

[ Reply to This | # ]
Prevent a given partition from mounting at boot
Authored by: whu on Tue, Oct 10 2006 at 1:48PM PDT
This is really an interesting idea. But I am not geeky enough to follow the instructions. Can anybody provide me a step-by-step guide to properly do it? Thanks!

[ Reply to This | # ]
Prevent a given partition from mounting at boot
Authored by: boredzo on Tue, Oct 10 2006 at 6:47PM PDT

… the UUID is the Universal Unique Identifier Drive.

No; UUID simply stands for “Universally Unique Identifier”. They have nothing to do with drives; this is simply one use of them.



[ Reply to This | # ]
Prevent a given partition from mounting at boot
Authored by: ken22 on Wed, Oct 11 2006 at 12:47AM PDT
It can be done easily with Drive Genius from Prosoft.

[ Reply to This | # ]
Prevent a given partition from mounting at boot
Authored by: cypherp on Mon, Mar 26 2007 at 7:31AM PDT
you'll give yourself a helluva fright if you do - on my setup 10.4.8 Drive Genius unmounts the disk, sure, but macos immediately tries to remount it, can't read the format and asks if you want to initialise it. every time you start up . Plus diskutility can't mount the partition, also seeing it as unformatted - and the whole point of this exercise is to have the disk easily to hand, just not using resources

I'm on a G4 windtunnel with 3 extra drives, and this little trick saves me about 30dB

my 2p

[ Reply to This | # ]
Prevent a given partition from mounting at boot
Authored by: tom larkin on Wed, Oct 11 2006 at 6:36AM PDT
This is nothing new, /etc/fstab has been in unix/linux for a long time. There are many ways to configure drives too, you can also use the volume=volumename instead of UUIDs, though UUIDs is probably the most secure method.

Also, you have to create the /etc/fstab file, by default its not in OS X. You can sudo pico /etc/fstab in the terminal, then type in your settings then write out the file.



[ Reply to This | # ]
Prevent a given partition from mounting at boot
Authored by: styrafome on Wed, Oct 25 2006 at 9:11PM PDT
Hey, this is a great tip. Despite my lack of Terminal experience, it works on my Mac Pro on 10.4.8. However, for other Terminal newbies I want to pass on what I learned...

I echo the comment about the fact that the fstab file does not exist and is created when you sudo pico and save the file with the line in it. There is also a file in etc called fstab.hd, but that isn't the file you're looking for. Don't edit that one.

No other lines in the fstab files are needed. Just the ones starting with the UUIDs of the drive you want to prevent automount on.

At first I did not see the UUID in Disk Utility, and figured out that you have to get info on the volume, not on the disk mechanism. You can then copy the UUID from Disk Utility and paste it into Terminal. Don't forget to add "UUID=" before it.

Thanks for the tip, I really needed it for a machine where I wanted to keep a certain volume offline when booted into the test OS.

[ Reply to This | # ]
Disable unwanted partition on USB stick
Authored by: tb on Wed, Jun 6 2007 at 5:47AM PDT
I have a "SanDisk Cruzer" USB memory stick, which contains two filesystems: the normal read/write filesystem, and a read-only ISO-9660 filesystem containing useless Windows software. The second filesystem appeared as a CD-ROM icon!

Both partitions needed to be unmounted (or ejected) before unplugging the USB stick to avoid an error message, although no harm could come of not ejecting the ISO-9660 filesystem. It was just a nuisance. However, this hint showed how to avoid it being mounted at all.

There was no UUID, so I used the volume name ("U3 System" in my case) and created a one-line /etc/fstab file containing:


LABEL=U3\040System none cd9660 ro,noauto
Note that the space in the volume name needs to be given in octal.

[ Reply to This | # ]
Disable unwanted partition on USB stick
Authored by: eitchbar on Sun, Feb 15 2009 at 5:30PM PST
I also have a "u3 system" partition (which looks to the system like a cd) on my sandisk cruzer. (what's it for, anyway? windoz doesn't seem to use it either)

I'm not getting an error, but it would be nice if I could have it never mount. I'm fairly new to terminal use... could you elaborate on what you did?

- That's /etc/ on the boot disk, right? Is there any way to have this travel with the stick drive?
- What exactly are the parts of none cd9660 ro,noauto doing?

[ Reply to This | # ]

Disable unwanted partition on USB stick
Authored by: Kanhef on Thu, Feb 19 2009 at 8:58PM PST
The idea is that you can put (U3-supporting) programs on it along with their settings. For example, you'd always have Firefox and all your bookmarks available, on whichever computer you happen to be using. It's annoyingly hard to get rid of – even reformatting the drive didn't work on mine. Fortunately, SanDisk does allow you to remove it. Unfortunately, it uses a Windows program.
http://www.sandisk.com/DriverDownload/index.asp
While it says it's a driver search, the uninstaller is one of the options. They try to make you register for spam, but there is a link to bypass it at the bottom.

[ Reply to This | # ]
Disable unwanted partition on USB stick
Authored by: gmachen on Thu, Dec 24 2009 at 11:16AM PST
There is a Mac utility to remove the stupid U3 partition:

http://communities.sandisk.com/sandisk/board/message?board.id=u3&thread.id=1066

--
> Disable unwanted partition on USB stick
>
> Authored by: Kanhef on Thu, Feb 19 2009 at 8:58PM PST
>
> The idea is that you can put (U3-supporting)
> programs on it along with their settings. For
> example, you'd always have Firefox and all your
> bookmarks available, on whichever computer you
> happen to be using. It's annoyingly hard to get
> rid of – even reformatting the drive didn't
> work on mine. Fortunately, SanDisk does allow you
> to remove it. Unfortunately, it uses a Windows
> program.
> http://www.sandisk.com/DriverDownload/index.asp
> While it says it's a driver search, the
> uninstaller is one of the options. They try to
> make you register for spam, but there is a link
> to bypass it at the bottom.

[ Reply to This | # ]
Prevent a given partition from mounting at boot
Authored by: hamaslama on Sat, Dec 15 2007 at 7:53PM PST
I can't quite seem to get this right. I'm a terminal newbie so I tend to cut and paste what I see here. Looks like this:

sudo pico /etc/fstab/UUID=09BFBF06-7E2F-3364-B894-649958051693 none hfs rw,noauto

I found the correct UUID, entered it all in Terminal as above, but it brings me into the Terminal Nano window and I can't figure out what exactly to do next...
Any help appreciated.

[ Reply to This | # ]
Prevent a given partition from mounting at boot
Authored by: hamaslama on Sun, Dec 16 2007 at 11:47AM PST
I figured it out.
Step by step it goes like this:
Open console, click on system.log, type "localhost diskarbitrationd" into the filter window, stretch the window the full width of your screen and you can copy the UUID of the disk you don't want to mount. Open TextEdit and paste it there.
Now open Terminal and enter "sudo pico /etc/fstab" then hit enter, enter your administrator password, now, go back to TextEdit and copy paste the following: "UUID="the UUID you copied from console" none hfs rw,noauto" and then cut and copy your UUID into the location between the quotes, of course leave out all of the quotes, then copy the whole string (mine looked like this: "UUID=09BFBF06-7E2F-3364-B894-649958051693 none hfs rw,noauto", then paste it into Terminal and hit enter. Next, type cntrl "O" (the letter O not the zero) then just hit the enter key and it should save the newly created fstab file in your~ /private/etc/directory.
Next, restart and the partition will not appear on the desktop but will be accessible with disk utility. Works like a charm. I'm using OS 10.4.10.

Hope this helps some newbie like myself...

[ Reply to This | # ]
Prevent a given partition from mounting at boot
Authored by: jkelk on Tue, Dec 18 2007 at 1:32PM PST
this hint no longer seems to work for 10.5.1, and /etc/fstab.hd says

IGNORE THIS FILE.
This file does nothing, contains no useful data, and might go away in
future releases. Do not depend on this file or its contents.

suggestions?

[ Reply to This | # ]
Prevent a given partition from mounting at boot
Authored by: rburgos on Sun, Jan 20 2008 at 2:00AM PST
I am wondering if you have found an alternative to this problem?
Thanks.

[ Reply to This | # ]
Prevent a given partition from mounting at boot
Authored by: Kanhef on Thu, Feb 19 2009 at 9:03PM PST
You need to create the file /etc/fstab (no extension), not edit /etc/fstab.hd .

[ Reply to This | # ]
Prevent a given partition from mounting at boot
Authored by: eitchbar on Sun, Feb 15 2009 at 6:08PM PST
this is handy now that many stick drives have a "U3 System" partition, which is useless for Mac users (next time I buy a thumb drive, I'll just erase the whole thing right off, but it's too late for that this time)

since the disk I want to disable mounting of is on a stick drive, I expect to be going from computer to computer (so a /etc/-based solution isn't ideal), and using computers where I'm not admin (so a /etc/-based solution isn't an option).

Is there a way to automatically, invisibly run a script when a drive mounts, as a sort of "mount items"? I could have something like
diskutil unmount (me)
run from a file on the disk, triggered by the disk itself. (If this is even possible, the script might have to be on the partition I'm keeping mounted?)

[ Reply to This | # ]