Tuesday, June 25, 2013

Prevent a partition from mounting in OS X


By on 6:15 PM

Prevent a partition from mounting in OS X


 When you boot OS X or attach a hard drive, the system will automatically try to mount any available volumes so you can access or format them for use. However, there may be times when you don't wish this to happen.
For example, if you have a dual-boot setup such as OS X 10.7 on one partition and OS X 10.8 on another, then you may wish to prevent one boot volume from being easily modified and perhaps corrupted when you are in the other operating system.
Volume UUID in OS X
Running "diskutil info" on the designated volume will reveal its UUID (click for larger view).
(Credit: Screenshot by Topher Kessler/CNET)
To do this, you will need to make use of the system's filesystem table (fstab) file, which manages special circumstances for the mounting of volumes in the system. Using the fstab file, you can set a volume to either not mount, or mount in read-only mode so it cannot be modified.


First, open the Terminal (in the Applications > Utilities folder) and type "diskutil info" followed by a single space. Then drag the desired disk to the Terminal window, and you should see a full path to it complete, so it looks something like the following command:
diskutil info /Volumes/Snow\ Leopard
Now press Enter to execute the command, and you should see a list of details about the drive. Locate the one called Volume UUID and select and copy this number.
Next, in the Terminal run the following command to edit the "fstab" file (you will be prompted for your password, which will not show when you type it):
sudo pico /etc/fstab
fstab modification in OS X
Use the UUID (red arrow) from the previous command, and then adjust the underlined options accordingly to prevent mounting or force read-only modes (click for larger view).
(Credit: Screenshot by Topher Kessler/CNET)
When done, a small editor will show in the Terminal. Enter one of the following lines, replacing "NUMBER" with the copied UUID from the prior command. Also, the use of "hfs" in these lines indicates the drive is in Apple's HFS format, so change it to "ntfs" or "msdos" for a drive that is formatted in NTFS or FAT32:
UUID=NUMBER none hfs rw,noauto

UUID=NUMBER none hfs ro
The first of these will prevent the drive from being mounted, but if you do mount it using Disk Utility or another means, then the drive will be read and writable. The second option will make the disk be treated as read-only, but it will still show up automatically in the Finder when you start your system.
When finished with the edit, press Control-O followed by Enter to save the changes, and then press Control-X to exit the editor.
To undo these changes, simply run the "sudo pico /etc/fstab" command in the Terminal again to edit the fstab file, and delete the lines you added.

(Credit: CNET)

About Syed Faizan Ali

Faizan is a 17 year old young guy who is blessed with the art of Blogging,He love to Blog day in and day out,He is a Website Designer and a Certified Graphics Designer.

0 comments:

Post a Comment