Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > macOS > Hiding Hard Drive Partition?

Hiding Hard Drive Partition?
Thread Tools
SSebeny
Junior Member
Join Date: Aug 1999
Location: Cuyahoga Falls, Ohio, USA
Status: Offline
Reply With Quote
May 20, 2005, 11:04 AM
 
Hi All,

In the department of my university where I work part time they are looking at a new solution for managing system installations on their Macs. Basically the idea is to have 4 partitions on the hard drive of each machine. Two will be for system installations, one for support stuff, and one for scratch. Then when the install on the machine is out of date, we will update the non-active install (the one the machine is NOT booted from) and then bless that other partition so when the machine reboots it will automatically boot to the new installation. The benefit being that we never have to take the machine out of commission to update the primary partition. The only problem we are facing is hiding the various partitions. If partition A is active, then B should NOT be visible to the user. Also the support partition would ideally be mounted at /Support and NOT shown on the Desktop. Does anyone know how to accomplish this? I can unmount and remount the support partition at /Support, but it still shows on the Desktop. And I can't figure out how to hide a partition from the users (desktop) at all while still having it mounted. Any suggestions or pointers to info would be GREATLY appreciated. Thanks!
     
westrock
Junior Member
Join Date: May 2005
Status: Offline
Reply With Quote
May 27, 2005, 03:13 AM
 
Let me make an idiot of myself

Does OSX use something similar to the /etc/vfstab that Unix uses to mount the partitions? If so you could possibly comment out an actual partition. Heres a cut and paste from a Solaris box we have at work, notice the mount at boot option. Putting a "#" in front would do the same type thing.


#device_________________device_________mount_____FS____fsck___mount___mount
#to mount_______________to fsck_________point______type__pass___at boot__options

/dev/dsk/c0t0d0s0____/dev/rdsk/c0t0d0s0____/________ufs_____1_____no_____logging
/dev/dsk/c0t1d0s2____/dev/rdsk/c0t1d0s2____/opt1_____ufs____2____yes____logging


Course I don't have access to an Apple here at work to see if it even uses this kind of file, so this may be completly useless to you.
     
SSebeny  (op)
Junior Member
Join Date: Aug 1999
Location: Cuyahoga Falls, Ohio, USA
Status: Offline
Reply With Quote
May 27, 2005, 12:12 PM
 
I tried reading books on Unix system administration to figure out how to do this, but none of them seem to match up with OS X. There is a /etc/fstab file and a /etc/fstab.hd file. But neither of them have any contents. In fact the .hd file just contains a comment saying "ignore this file!" So I don't know how to tell the Finder not to display a partition. If anyone else has any suggestions I'd still love to hear them! Thanks!
     
chabig
Addicted to MacNN
Join Date: Jun 1999
Location: Las Vegas, NV, USA
Status: Offline
Reply With Quote
May 27, 2005, 12:44 PM
 
Hiding the unused system partition is easy. Just write a script to unmount it after booting or logging in. As for hiding mounted partitions, I don't think that's possible.

Chris
     
SSebeny  (op)
Junior Member
Join Date: Aug 1999
Location: Cuyahoga Falls, Ohio, USA
Status: Offline
Reply With Quote
May 27, 2005, 12:52 PM
 
Ya, we want to hide mounted partitions. Hide might even be the wrong word. We just don't want them shown in the Finder, its OK if they are still accessible from the Terminal.
     
webb3201
Senior User
Join Date: Nov 2001
Location: Dallas, Texas
Status: Offline
Reply With Quote
May 29, 2005, 10:21 PM
 
I just did exactly that accidentally with a partition on my firewire drive! Not sure how and was not happy about it
Read my MacWebb column and other great Mac articles at Lowendmac.com

Owner of a MacBook Pro and various other Macs.
     
khufuu
Registered User
Join Date: Aug 2002
Location: On my couch
Status: Offline
Reply With Quote
May 30, 2005, 12:41 AM
 
I'm assuming that your users don't have root level access.

Have you tried to change the permissions on the mount points? (ie: chmod 700 /Support)
     
Big Mac
Clinically Insane
Join Date: Oct 2000
Location: Los Angeles
Status: Offline
Reply With Quote
May 30, 2005, 03:51 AM
 
This article may help - closest thing I could find.

"The natural progress of things is for liberty to yield and government to gain ground." TJ
     
ideasculptor
Forum Regular
Join Date: Dec 2004
Status: Offline
Reply With Quote
May 30, 2005, 07:18 AM
 
I have a 'houseguest' account with limited permissions. I made some partitions not readable or writeable for the houseguest account and they don't show up on that user's desktop or finder. If I FUS to my own account, all 6 partitions show up again. Unfortunately, I can't remember what i did to limit read and write permissions on those partitions. It could be that I made them only read and writeable by administrator accounts (660) in the info panel for those partitions.

--sam
     
khufuu
Registered User
Join Date: Aug 2002
Location: On my couch
Status: Offline
Reply With Quote
May 30, 2005, 10:34 AM
 
Originally Posted by ideasculptor
I have a 'houseguest' account with limited permissions. I made some partitions not readable or writeable for the houseguest account and they don't show up on that user's desktop or finder. If I FUS to my own account, all 6 partitions show up again. Unfortunately, I can't remember what i did to limit read and write permissions on those partitions. It could be that I made them only read and writeable by administrator accounts (660) in the info panel for those partitions.

--sam
Good. So my suggestion should work. Note: you must have execute permissions on a folder in order to see what's inside it. So 770 was probably what you used. I suggested 700 just so you know that the owner has exclusive access.
     
khufuu
Registered User
Join Date: Aug 2002
Location: On my couch
Status: Offline
Reply With Quote
May 30, 2005, 10:35 AM
 
Originally Posted by Big Mac
This article may help - closest thing I could find.

I had never heard of that command before.
     
Rainy Day
Grizzled Veteran
Join Date: Nov 2001
Location: Oregon
Status: Offline
Reply With Quote
May 31, 2005, 04:39 AM
 
There are a couple ways to do this. First way is to use /etc/fstab. If you want to hide a partition named "Yoda," for example, you'd make an entry like this:

[FONT=Courier New]LABEL=Yoda /Volumes/Yoda hfs rw,noauto 1 2[/FONT]

This prevents the drive from mounting at startup (so it won't be visible in Terminal nor Finder). The other way is to simply put a "." (dot) as the first character of the volume name. This mounts the drive (is accessible from the Terminal), but makes it invisible in the Finder.

Enjoy.
     
P
Moderator
Join Date: Apr 2000
Location: Gothenburg, Sweden
Status: Offline
Reply With Quote
May 31, 2005, 12:56 PM
 
Originally Posted by khufuu
I had never heard of that command before.
It's an Apple command for modifying the old flags from OS 9 (or OS 8, 7, 6... they've been there forever). The one they're modifying is the "Invisible" flag. That will hide the partition (or any file...) from the Finder, but it will still be visible from the Terminal. Isn't that what exactly what was requested?

I think the "SetFlag" tool is included with the Developer tools, so you'll have to copy it form an installation that has those.

I think it's illegal according to HFS+ to name a partition something that begins with a dot - I know NU used to check for that in OS 8 or 9 - but go ahead and try.

Finally, you can hide files with a simple text file ".hidden" in the directory - see the one in the root directory, but it's just a lits of file names. Have some startup script create it in /Volumes and incude the name of the other partition and that should be it.
     
Rainy Day
Grizzled Veteran
Join Date: Nov 2001
Location: Oregon
Status: Offline
Reply With Quote
May 31, 2005, 01:34 PM
 
Originally Posted by P
I think it's illegal according to HFS+ to name a partition something that begins with a dot
No, the dot-filename approach is not at all illegal in HFS+. Apple has all kinds of files beginning with a dot (e.g. .DS_Store). The Mac GUI, however, generally doesn't allow you to name a file that way, which may be what you're thinking. And that makes sense when you think about it from a UI standpoint: You don't want files magically disappearing on users (especially with no easy way to get them to reappear).

But from the Terminal, it is easy enough to rename a file to start (or not) with a dot. To view, simply use ls -a

SetFlag works by modifying the HFS flags. The dot approach is a more Unix-like approach. Either should work, but the SetFlag approach has the drawback that it requires Developer Tools; it is also the more difficult to use, in my opinion. The dot approach is quick and easy, definitely does work (i've used it before on volumes), and doesn't require Developer Tools. I've not tried the SetFlag approach with a volume, so don't know for sure if that works on anything but files.

In my experience, use of .hidden does not produce reliable results. But then i haven't tried it since 10.2.

For the originally stated purpose, however, i believe the /etc/fstab solution i mentioned earlier is best (as it prevents the volume from being mounted, and so can't be accidentally modified or otherwise discovered).

Also, i forgot to mention, you might want to be aware of Radmind: "A suite of Unix command-line tools and a server designed to remotely administer the file systems of multiple Unix machines. For Mac OS X, there's also a graphical interface."
     
trip
Forum Regular
Join Date: Mar 2005
Location: Calgary Canada
Status: Offline
Reply With Quote
Jun 1, 2005, 02:54 PM
 
Originally Posted by Rainy Day
There are a couple ways to do this. First way is to use /etc/fstab. If you want to hide a partition named "Yoda," for example, you'd make an entry like this:

[FONT=Courier New]LABEL=Yoda /Volumes/Yoda hfs rw,noauto 1 2[/FONT]

This prevents the drive from mounting at startup (so it won't be visible in Terminal nor Finder). The other way is to simply put a "." (dot) as the first character of the volume name. This mounts the drive (is accessible from the Terminal), but makes it invisible in the Finder.

Enjoy.
These maybe stupid questions but I'm am not a unix guy - at all.

1. How do you undo (incase i need to):
[FONT=Courier New]LABEL=Yoda ./Volumes/Yoda hfs rw,noauto 1 2[/FONT]

2. Will this be on a user by user basis ? i.e. as system admin I would like to prevent any access to all partitions (even by view) allowing users to access the user directory only (from finder), but with my account I would like them to be in view.

3. Is it a bad idea to do this to all partitions ? I know the previous post was expecting one partition in view, but I would like none.

Please and Thanks for any information.
"The direct use of force is such a poor solution to any problem, it is generally employed only by small children and large nations". --David Friedman
     
Rainy Day
Grizzled Veteran
Join Date: Nov 2001
Location: Oregon
Status: Offline
Reply With Quote
Jun 1, 2005, 09:04 PM
 
Originally Posted by trip
These maybe stupid questions but I'm am not a unix guy - at all.
The only stupid question is one you already know the answer to.

1. How do you undo (incase i need to):
[FONT=Courier New]LABEL=Yoda ./Volumes/Yoda hfs rw,noauto 1 2[/FONT]
Place a pound-sign (#) at the start of the line (it makes the whole line into a comment, which is then ignored), or delete the line from the file.

Note: The /etc/fstab file is read only at startup, thus it is used to set the initial state of the disk/filesystem.

2. Will this be on a user by user basis ? i.e. as system admin I would like to prevent any access to all partitions (even by view) allowing users to access the user directory only (from finder), but with my account I would like them to be in view.
That depends on the value of the second parameter. In the example above, the volume is being placed in a public area visible to all users (except in the above example the noauto parameter causes the volume not to be mounted, which renders the location moot).

Now since what you want is for certain volumes to be available to just a single user, and not available to other users, you may want to understand what that second parameter does. It tells the OS where to add that volume in the directory structure. Unlike many other OS's, Unix doesn't have unique volumes per se. Instead, it implements a single directory hierarchy, and volumes - i.e. either disk partitions or physical drives - are mounted somewhere in the directory tree. MacOS X mounts "volumes" at /Volumes, and the Finder creates the illusion that volumes mounted there are separate volumes, just like in the Classic MacOS. But your volumes do not have to be mounted there, and if they aren't, then the Finder will not treat them like separate volumes.

So you could specify a mount point of /Users/yoda/Music/, for example, in which case the volume would be available exclusively as the "Music" folder for the user "yoda". Normally, this folder is not visible to anyone but the owner.

Note: When you mount a device, you do so on a folder somewhere in the directory tree. If that folder happens to contain any files, those files will disappear (until the volume is subsequently unmounted)... unless the "union" option is selected (which makes both the underlying files and the mounted files visible; writes occur only the the mounted volume, though).

You can learn more about this Unix sorcery by issuing these commands in the Terminal:

man fstab
man mount
man umount

3. Is it a bad idea to do this to all partitions ? I know the previous post was expecting one partition in view, but I would like none.
That depends on what you want to achieve. Obviously you can't tell the boot volume not to mount (it's already mounted by the boot process). If you don't want any of the other volumes to mount, then by all means go for it. My guess is that's not what you want though. In most cases, you probably want the volumes to mount; it's just a question of where. Only in a few special cases, like the original poster's situation, would you normally want to prevent a volume from mounting.

Please and Thanks for any information.
You're welcome!
     
P
Moderator
Join Date: Apr 2000
Location: Gothenburg, Sweden
Status: Offline
Reply With Quote
Jun 2, 2005, 01:17 PM
 
Originally Posted by Rainy Day
No, the dot-filename approach is not at all illegal in HFS+. Apple has all kinds of files beginning with a dot (e.g. .DS_Store). The Mac GUI, however, generally doesn't allow you to name a file that way, which may be what you're thinking. And that makes sense when you think about it from a UI standpoint: You don't want files magically disappearing on users (especially with no easy way to get them to reappear).

But from the Terminal, it is easy enough to rename a file to start (or not) with a dot. To view, simply use ls -a
Of course you can name FILES beginning with a dot. I was talking about PARTITIONS. Not the same thing - the partition name is an entry in the partition map, not in the filesystem table or B-Tree (so I guess I was wrong calling it illegal under HFS - should have said that it might be illegal under the partition scheme Apple uses). I seem to vaguely remember that dot-names in the partitions are reserved for Apple use, but that may be outdated information.
     
Rainy Day
Grizzled Veteran
Join Date: Nov 2001
Location: Oregon
Status: Offline
Reply With Quote
Jun 2, 2005, 01:40 PM
 
As previously posted, i have used volume names beginning with a dot and not only does HFS like it, the volume becomes invisible in the Finder (as you would expect, given that the same thing happens with files).

The difference between using the dot prefix and using the /etc/fstab approach is that in the former, the volume is mounted and accessible (provided you know how to access it); in the latter, it's not on-line at all.
     
   
Thread Tools
 
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Top
Privacy Policy
All times are GMT -4. The time now is 09:36 AM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,