Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,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 3.27 / 5
  You rated: 2 / 5 (11 votes cast)
 
[122,282 views]  

Prevent a given partition from mounting at boot | 37 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 whoever posted them. This site is not responsible for what they say.
Prevent a given partition from mounting at boot
Authored by: AquaX on Oct 10, '06 08:11:28AM

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 Oct 10, '06 10:15:01AM

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 Oct 11, '06 02:38:24AM
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 Oct 11, '06 01:46:36PM

Hey! You have the same UUID as me! :-)



[ Reply to This | # ]
Prevent a given partition from mounting at boot
Authored by: transeau on Oct 10, '06 11:00:44AM

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 Oct 10, '06 11:39:10AM

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 Oct 10, '06 04:11:39PM

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 Apr 18, '07 08:33:03PM

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 Oct 10, '06 01:48:37PM

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 Oct 10, '06 06:47:03PM

… 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 Oct 11, '06 12:47:34AM

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 Mar 26, '07 07:31:58AM
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 Oct 11, '06 06:36:35AM

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 Oct 25, '06 09:11:37PM

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 Jun 06, '07 05:47:47AM
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 Feb 15, '09 05:30:36PM
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 Feb 19, '09 08:58:45PM
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 Dec 24, '09 11:16:12AM

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 Dec 15, '07 07:53:12PM

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 Dec 16, '07 11:47:42AM

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 Dec 18, '07 01:32:00PM

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 Jan 20, '08 02:00:07AM

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 Feb 19, '09 09:03:48PM

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 Feb 15, '09 06:08:11PM
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 | # ]

Prevent a given partition from mounting at boot
Authored by: mistercoffee2 on Aug 15, '11 09:10:32PM

For 10.7 Lion the file is /private/fstab

UUID=FAB060E9-79F7-33FF-BE85-E1D3ABD3EDEA none hfs rw,noauto



[ Reply to This | # ]
Prevent a given partition from mounting at boot
Authored by: 500F on Sep 01, '11 09:53:00AM

Hi,

I have tried those suggestions previous to last one posted.
Being that I'm in Lion, I think that's why they didn't work.

I have 2 questions:

1-From those attempts, there were created 3 files in "etc" folder: fstab.save, fstab.save.1, and fstab.save.2
Will it be safe to delete those files being that they only contain what I wrote in my 3 attempts?
-UUID=E095D3F5-F170-3D34-8A52-7DD6EB5530E2
-UUID=E095D3F5-F170-3D34-8A52-7DD6EB5530E2 none hfs rw,noauto
-UUID=E095D3F5-F170-3D34-8A52-7DD6EB5530E2 none ntfs ro,noauto 0 0

and...

If I create a new file fstab in the folder "private" and no in "private/etc" as per last update (UUID=XXX-XXX-XXX-XXX-XXX none hfs rw,no auto),

2-Will the command work to avoid an iPod to mount when I start the machine?

Thank you,



[ Reply to This | # ]
Prevent a given partition from mounting at boot
Authored by: cshander on Sep 04, '11 05:47:07PM

I am in Lion, and the /private/fstab didn't work for me - but the original /etc/fstab did. I have been using that method for years.



[ Reply to This | # ]
Prevent a given partition from mounting at boot
Authored by: MacTipster on Oct 06, '11 01:45:49PM

Is there any application to prevent default automatic mounting partitions or full disks after rebooting or cold booting?

That is handy when there are several partitions or full disks used for repair that are not usually required for working on a daily basis.

Thanks.



[ Reply to This | # ]
Prevent a given partition from mounting at boot
Authored by: MacTipster on Nov 05, '11 10:28:39AM

I have found such application:

TinkerTool System
http://www.bresink.com/osx/300321023/details.html

Configure it at "TinkerTool System - System Settings - Volumes - Exclude volumes from automatic mounting".



[ Reply to This | # ]
Prevent a given partition from mounting at boot
Authored by: MacTipster on Apr 09, '13 03:25:57PM

And yet another one:

Unmount Volumes
http://www.redcliffetechnology.com/content/Unmount_Volumes.html
http://www.macupdate.com/app/mac/31865/unmount-volumes



[ Reply to This | # ]
OS X 10.7 Lion, customizing mount points
Authored by: magnamous on Apr 20, '12 08:50:00PM
I just tried this on 10.7.3 and it worked. A few updates:
  • the UUID can be found in Disk Utility (File > Get Info on a volume)
  • the UUID can also be found using diskutil info /Volumes/yourVolumeName in Terminal
  • the preferred way to edit /etc/fstab is now by using the command sudo vifs, but that means you have to edit using Vim. Vim can be learned by typing the command vimtutor. I just used sudo nano /etc/fstab because I didn't know at the time.

I also noted that this can be used to change the mount point of the volume. I have an external 2.5" drive that I use for my iTunes folder, but I also have a partition with a copy of the OS X installer, as well as one with DiskWarrior on it. I used the hint to hide the two boot volumes, but I also set the largest partition to mount as the iTunes folder in my home folder, so the entry looked something like this:
UUID=myPartitionsUUID  /Users/me/Music/iTunes  hfs  rw,auto
Now, when I plug in the drive, the boot partitions don't mount, and the other one mounts in place of the default iTunes folder. Some notes:
  • If you customize the mount point, make sure that the destination folder already exists. If it doesn't, it won't mount, and Disk Utility will claim that there's something wrong with the drive. In other words, if your mount point is /Users/you/Music/someSubFolder, make sure that someSubFolder already exists.
  • If your customized mount folder already has stuff in it, you will lose access to that stuff while the volume is mounted. When it is unmounted, the regular folder's contents will return.
  • Strangely, the iTunes partition also mounts at the "Computer" level, though it does not in /Volumes. I don't know why.
  • Also strange: I can't rename the partition in the Finder once I've added the entry in fstab. That is, if your partition is named "Seagate", when it mounts, the iTunes folder will disappear and be replaced by an icon named "Seagate", with whatever icon the partition has. If you try to rename it to iTunes, the change won't take. Unmount the drive, comment out (#) the appropriate line in fstab, mount the drive, change the name, unmount, remove the comment character in fstab & save, remount, and it should appear with your desired volume name.
  • I have no idea whether anything I've suggested here is monumentally stupid and may destroy everything you hold dear. If someone does know, I would appreciate being enlightened.
Edited on Apr 20, '12 10:35:57PM by magnamous


[ Reply to This | # ]
OS X 10.7 Lion, customizing mount points
Authored by: psaxo on Aug 22, '12 05:29:27PM

Thanks for the tips. vimtutor is great!



[ Reply to This | # ]
OS X 10.7 Lion, customizing mount points
Authored by: andrewwynn on Dec 02, '12 10:22:25PM

Super helpful with one major caveat; breaks time-machine restore capability. Backups still happen but you can not restore items that are within the drive mounted to a mount point!

The hint was still very helpful; i just set the mount folder to 'none' and put symlinks where i want to 'see' the drive; it leaves the original drive 'as was' in volumes but at least mounts at startup so my users drive now works again!



[ Reply to This | # ]
Prevent a given partition from mounting at boot
Authored by: MacTipster on Apr 21, '13 03:12:44PM

In summary, what is the best way to prevent a given partition from mounting at boot?
A step-by-step procedure for dummies and people not mastering Terminal will be most appreciated.



[ Reply to This | # ]
Prevent a given partition from mounting at boot
Authored by: MacTipster on Apr 26, '13 04:29:41AM

How to do it (previous post)? Thanks.



[ Reply to This | # ]
Prevent a given partition from mounting at boot
Authored by: MacTipster on May 17, '13 10:30:07AM

Someone knows how to do this?
Prevent the internal disk from mounting on two different Macs (at work and home) when booted from the same external disk. The procedure should not interfere with DiskWarrior and Apple Time Machine. Thanks.



[ Reply to This | # ]
Prevent a given partition from mounting at boot
Authored by: MacTipster on May 25, '13 03:26:28AM

Somebody knows? Thanks.



[ Reply to This | # ]