Contribute
Register

[GUIDE] Hide Windows Partition / Any Other Partition in OS X

Status
Not open for further replies.
Joined
Dec 18, 2010
Messages
162
Motherboard
ASUS ROG GL502VM
Hi,

I just learned how to do this and thought I'd share a step by step for those who are like me who love a clean desktop and don't like their windows partition sticking out.

Basically all we are going to do is create a shell command that will unmount these partitions, and set that shell command to exec with boot, you can always remount later by just going into disk utility and remounting them.

STEP 1: Choosing The Partition(s) We Want To Hide
Firstly, We need to choose what we want to hide. As you can see below I have my Lion Installer Partition and my Windows Partition that I don't want there anymore. So I will just remember/write down the names of the two partitions (Easy enough) for later.
Yj6du.png


STEP 2: Creating The Executable to Unmount the Partitions
Now comes the Terminal fun! We are going to use terminal to create the exec file to unmount these partitions. So open up terminal!

1. Ok first we need to choose a place where this file is going to go (It can be moved later). For ease, I will just choose the Desktop for now. So firstly in terminal type in
"cd Desktop" , No quotation marks.
pT8Zf.png


2. Ok now that we chose where the exec will go, Now comes the process of making the executable. So now that we have enterred "cd Desktop" we are now going to run the nano command followed by your desired name for the exec. The nano command is what allows us to compile these exec's.
So in terminal type "nano "File Name"" IMPORTANT: The quotation marks surrounding File Name are only needed if you want a title with a space in it. For example I called mine "Hide Partitions" so it has to be in quotation marks since it has a space. If your title of the file is spaceless, ignore the quotations around it.
After typing in "nano "File Name"" (Ignore the quotation marks when entering into terminal), Press return, a new window will open.
90QKY.png

After Pressing Return, This will appear.
KUbiF.png


Now we start the fun
So now is when we will program our exec file to do what we please. In my case I will be making it hide my Installer partition, and my Untitled(Windows) Partition.
So I simply first type in "diskutil unmount '/Volumes/Installer'" Without quotation marks. Also, That last apostrophe after your Partitions name is necessary. Do not get rid of it. After that I want to add the same line of code for my Untitled Partition, So I press Return to go down a line and type in "diskutil unmount '/Volumes/Untitled'"
SVRP9.png

These are commands that unmount your partitions.
After that we want to add another line of code under them that says "Killall Terminal" without quotations then press enter, It will go to a new line. This command is to simply close terminal when its done.
l89fG.png


OK! So now we are ready to compile this as an executable! At the bottom of the nano window you will see it says to press ^x to Exit, press it! It will then give you the options for Yes, No, and cancel. press Y for Yes if you are ready to proceed.
mKLar.png

Then it will say "File name to Write" Whatever you named it" Then press Enter to confirm!
Pp5qG.png


So now we have a text file on our desktop, BUT WE ARE NOT DONE YET! Now we have to compile this to an exec file. So with your terminal still open (If you quit just re open and redo the cd Desktop.) We are going to type in "chmod +x "Your Files Name"" Remember to ignore the quotations around the command when typing in terminal, and as for the quotations around your files name, only use if you used quotations originally as I explained in red up there^.
HdJBR.png

Press enter. You now have a compiled and ready to use command file! Go ahead, double click it and test it out! Now for people who like to keep it clean, I moved it to my User Folder and in System Settings>User Settings> User> Login Items> I added the unix Exec we made to launch with boot.
Jpv2p.png


REMOUNTING YOUR DRIVE
Say for some reason you need to temporarily get back into the drive you want to hide. Just open Disk Utility, Right click the unmounted partition and select Mount!
Dh3Xe.png


And thats, it. You have successfully hidden your extra drives.
 
Thanks for the guide!

Just what i was looking for
 
Thanks for the guide!

I'd like to use it for another user on the computer, who is no admin. How do I execute it with admin rights (without entering adminuser/pass each time)?

Cheers
Vulpini
 
As an alternative you can create the fstab file ( /etc/fstab )

And follow this examples to insert on that file:
Code:
UUID="PART_UUID" none ntfs ro,noauto
UUID="PART_UUID" none hfs rw,noauto

Change the PART_UUID for your partition UUID, without the quotes. You can check the UUID's with Disk Utility.

Don't forget to modify the file system according the partition (ntfs, hfs, msdos). And the permissions, ro = read-only or rw=read-write.

With this method, you can also mount the partition later with Disk Utility if you want.
 
Hi,
Thank you, one word only : Perfect !
Just what I need,
and even more, my first Unix Executable : LOL
Zavatar69,
 
Years later and this post is still GOLD!

THANK YOU!!!
 
My alternative way to avoid a terminal window popup when startup: Open Automator, create new Application, type Run Shell Script on the search bar and drag & drop it to the right workflow panel. Then type these commands
Code:
if [ -d "/Volumes/WINDOWS" ]
then diskutil unmount '/Volumes/WINDOWS'
fi

Replace "WINDOWS" with your partition name. After that hit File > Save and choose to save as a application. Then open System Settings>Users & Groups> User> Login Items> add the application you just made, remember to check "Hide" box.

Done, logout and then re-login to enjoy.
 
Last edited:
My alternative way to avoid a terminal window popup when startup: Open Automator, create new Application, type Run Shell Script on the search bar and drag & drop it to the right workflow panel. Then type these commands
Code:
if [ -d "/Volumes/WINDOWS" ]
then diskutil unmount '/Volumes/WINDOWS'
fi

Replace "WINDOWS" with your partition name. After that hit File > Save and choose to save as a application. Then open System Settings>Users & Groups> User> Login Items> add the application you just made, remember to check "Hide" box.

Done, logout and then re-login to enjoy.

Thanks Whisky - that was very helpful.
 
My alternative way to avoid a terminal window popup when startup: Open Automator, create new Application, type Run Shell Script on the search bar and drag & drop it to the right workflow panel. Then type these commands
Code:
if [ -d "/Volumes/WINDOWS" ]
then diskutil unmount '/Volumes/WINDOWS'
fi

Replace "WINDOWS" with your partition name. After that hit File > Save and choose to save as a application. Then open System Settings>Users & Groups> User> Login Items> add the application you just made, remember to check "Hide" box.

Done, logout and then re-login to enjoy.
For me the script has to be without quotation marks like

Code:
if [ -d /Volumes/<partition name> ]
then diskutil unmount /Volumes/<partition name>
fi

and the Automator application should be run once so it will really work in the future. I use it to hide System Reserved of an ancient build.
 
Status
Not open for further replies.
Back
Top