I have created 3 partitions on a hard drive.
I've tried renaming the partition with a dot in front, however it seems that the OS doesn't allow that.
How to make one of the 3 partitions hidden to the user?
I have created 3 partitions on a hard drive.
I've tried renaming the partition with a dot in front, however it seems that the OS doesn't allow that.
How to make one of the 3 partitions hidden to the user?
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.
/usr/bin/SetFile
was deprecated with Xcode 6 along as were other tools supporting Carbon development; although SetFile
still appears to install as part of Xcode 12 command line tools.
– marc-medley
May 29 '21 at 02:52