How to create a hidden partition on a hard drive?
My previous answer is preserved below.
You can use the chflags
command to apply the hidden
attribute:
chflags hidden /Volumes/Hide_this_disk
And to unhide:
chflags nohidden /Volumes/Hide_this_disk
These commands should take effect immediately.
You need to have the Apple Developer Command Line Tools installed. You can either get them from inside of Xcode (in Preferences under Downloads) or you can download them from Apple's Developer website (free registration required).
After it's installed you'll have the SetFile
command:
SetFile -a V /Volumes/Hide_this_disk
This needs to be executed as root
, and it won't vanish right away. But after remounting it, it won't be displayed in the Finder any more. You'll need to use Disk Utility (or diskutil
) to mount and unmount the disk afterward since it won't be visible to unmount and it will still be available under /Volumes
normally.
If it's an internal disk then I believe that it will auto-mount at boot, but I don't know for certain.
To make it visible again just run the same thing, but with a small v
:
SetFile -a v /Volumes/Hide_this_disk
Again, you'll need to remount it.