This method involves utilizing the File System Table (fstab) for the BSD subsytem.
First you need to know the mount points of the partitons you don't want to see. I'll use "winxp" and "backup" for the examples. If you didn't know, the partition on which OS X resides is mounted to / (root), and all subsequent partitons are mounted to /Volumes/. You can find the mount point of any given partiton using disk utility, selecting the partiton and hit the info button up top. I have 2 drives. One with 2 partitions and one with 3 partitions. The primary drive has my OSX partition and one for winxp. The second drive has a documents partition, and media partition, and a backup partition. For day to day use in OS X I don't want to see the winxp nor the backup partions. From disk utility, I find their mount points are /Volumes/winxp and /Volumes/backup respectivley.
The first thing we need to do is to crate the fstab file in the /etc folder. Open up a Terminal and:
sudo nano /etc/fstab
now we need to edit to suit our needs. The typical entry line in fstab contains on line for each mount, with the data in the format :
file system mount-point type options
So to tell it to not mount a specific drive or partition, we just need to specify not to do so.
LABEL=winxp none ntfs ro,noauto LABEL=backup none HFS+ ro,noauto
In the example,
"LABEL=winxp" is my windows partition, "none" is the mount point, "ntfs" is the type, and "ro,noauto" are the options.
You must use the appropriate type for the partiton, ie: ntfs HFS HFS+ msdos etc.
The options "ro,noauto" mean read only, don't auto mount. For read / write of supported file systems use rw.
If your partition name has a space on the name, you need to replace the space with "\040" ie. "LABEL=Win\040XP" for Win XP.
Once you have the code entered, hit cntrl-x and it will ask if you want to save. Hit y for yes, and it'll ask if you want to save it as fstab. Hit enter.
Now just restart, and the drives won't auto-mount.
Method 2:
Technically, this method will not enable you to pick which partitions to auto-mount. It will have the desired effect though, as it will auto-unmount selected partitions at login.
The proceedure is rather simple in that you just add a short login script to unmount the partitions you don't want to see.
Once again you need to know the mount points of the partitons you don't want to see. I'll use "winxp" and "backup" for the examples. If you didn't know, the partition on which OS X resides is mounted to / (root), and all subsequent partitons are mounted to /Volumes/. You can find the mount point of any given partiton using disk utility, selecting the partiton and hit the info button up top. I have 2 drives. One with 2 partitions and one with 3 partitions. The primary drive has my OSX partition and one for winxp. The second drive has a documents partition, and media partition, and a backup partition. For day to day use in OS X I don't want to see the winxp nor the backup partions. From disk utility, I find their mount points are /Volumes/winxp and /Volumes/backup respectivley.
Now that we know the mount points it's time to make the script. I also made a directory to store scripts in.
Open terminal (Applications/Utilities/Terminal)
I made a folder in /Library called Management to store the script in:
sudo mkdir /Library/Management
The sudo command makes you the super user (*nix) / administrator, and grants you full access, and you will need to enter your password.
To create the script :
sudo nano /Library/Management/login.sh
nano is a command line (terminal) text editor, and the command above will create and open "login.sh" in the /Library/Management folder.
The script itself needs just a few basics
#!/bin/bash umount /Volumes/winxp umount /Volumes/backup exit 0
The first line tells the computer to use the bash shell, and it's an exclamtion point ! not a 1
you need one "umount" line for each partition you want to unmount. The command is "umount" only one n.
exit 0 tells the computer to exit the script with a 0 status.
Once you have the code entered, hit cntrl-x and it will ask if you want to save. Hit y for yes, and it'll ask if you want to save it as login.sh. Hit enter.
Now you need to ensure that the script has the proper permissions and is executable.
In Terminal :
sudo chmod u+x /Library/Management/login.sh
Now add the script to run at login.
In Terminal
sudo defaults write com.apple.loginwindow LoginHook /Library/Management/login.sh
Close the terminal, logout and back in and the drives should be gone.
If for some reason you want to mount a drive you have umounted using this script, simply edit the login script and insert a " # " at the begining of the line for that drive.
Example:
#!/bin/bash umount /Volumes/winxp #umount /Volumes/backup exit 0
If for some reason down the line you wish to remove the login script alltogether, then;
sudo defaults delete com.apple.loginwindow LoginHook.



Sign In
Create Account









