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 > 'mount -o bind' equivalent

'mount -o bind' equivalent
Thread Tools
macmike42
Senior User
Join Date: Dec 2001
Status: Offline
Reply With Quote
Mar 21, 2004, 03:50 PM
 
I have an UltraATA/133 card in my beige G3 (er G4). Unfortunately, the machine will not boot (Linux, Classic Mac OS, OS X any version) from anything but the onboard ATA/33 controller. So my plan is to install OS X on an old 4GB drive so I can boot and have my daul Maxtor 60GB 7200RPM 8MB cache drives hooked up to the card. Obviously, a 4GB drive is a little tight, especially with dev tools installed, plus the system, system applications, developer applications, and vm would all be on the 4GB drive by default.

Now, I know can parition one or both of the Maxtor drives and simply force those paritions to mount at /var/vm (yes I know this one won't work, I know what is required to move the swap file), /Applications, and /Developer/Applications, but I would prefer to not partition, and perhaps to set up the two 60GB drives for RAID.

Under Linux, this would be as simple as mount /dev/hdaX /Applications -o bind, but I can't seem to find any equivalent to a bind mount (admittedly a sloppy hack, but a useful sloppy hack) under Darwin/*BSD. Any ideas?
( Last edited by macmike42; Mar 24, 2004 at 07:58 PM. )
"Think Different. Like The Rest Of Us."

iBook G4/1.2GHz | 1.25GB | 60GB | Mac OS X 10.4.2
Athlon XP 2500+/1.83GHz | 1GB PC3200 | 120GB | Windows XP
     
Rainy Day
Grizzled Veteran
Join Date: Nov 2001
Location: Oregon
Status: Offline
Reply With Quote
Mar 27, 2004, 12:40 PM
 
Not knowing what a mount -o bind does, it is a little hard to answer your question.

However given the problem you've stated, one solution is to install MacOS X on the internal drive, then mount one of your external drives on top of / with a -o union option. This would effectively give you a boot volume the size of the larger of the two disks.

The union option makes both file systems visible � with the underlying file system read-only, while the overlying file system is read/write. I imagine this has some performance penalties, however.

On the other hand, i have to say that 4 GB is plenty of space for MacOS X, when you apply a standard mount to those directories likely to require more headroom (e.g. /home, /Developer, /private, /Applications, etc.)
     
macmike42  (op)
Senior User
Join Date: Dec 2001
Status: Offline
Reply With Quote
Mar 28, 2004, 09:10 PM
 
Sorry, "mount -o bind" binds one filesystem path to another. With this option, I could do this sort of thing:

mount -o bind /Volumes/HD2/Developer /Developer

and have /Developer actually reside on another drive. Any files created at /Developer would be created at /Volumes/HD2/Developer. Any files already in /Developer on the boot drive would simply be unavailable until /Developer was unmounted (said differently, until /Volumes/HD2/Developer was unbound from /Developer).

It sounds like the union option is the more advanced of the two options, I am unsure if Linux has that option (in WinXP right now, grr, need MS Access on OS X).

Does the union option provide a method to decide which drive winds up storing newly created files?
"Think Different. Like The Rest Of Us."

iBook G4/1.2GHz | 1.25GB | 60GB | Mac OS X 10.4.2
Athlon XP 2500+/1.83GHz | 1GB PC3200 | 120GB | Windows XP
     
Rainy Day
Grizzled Veteran
Join Date: Nov 2001
Location: Oregon
Status: Offline
Reply With Quote
Mar 29, 2004, 04:52 AM
 
So you can access it as either /Volumes/HD2/Developer or /Developer? Sounds like you're creating a wormhole between two directories.

Originally posted by macmike42:
Does the union option provide a method to decide which drive winds up storing newly created files?
It's the last one (i.e. the underlying directory temporarily becomes read-only... until the union is broken/dismounted.) I believe you can stack unions on top of each other, but only the last one is RW.

I think unions are a BSD'ism.
     
Rainy Day
Grizzled Veteran
Join Date: Nov 2001
Location: Oregon
Status: Offline
Reply With Quote
Mar 29, 2004, 01:39 PM
 
I should add that as of Jaguar, MacOS X supports /etc/fstab, and in fstab you can specify a union mount. Also, unique to MacOS X (i think), is the ability to specify a HD by name. (Spaces in volume names need to be backslashed; quotes don't work.) Here's a sample fstab file:
Code:
# device mount point filesystem fs options dump fsck LABEL=.xSwapVol /private/var/vm hfs rw 1 2 LABEL=.myHD /home hfs rw,union 1 2 LABEL=Yoda /Volumes/Yoda hfs rw,noauto 1 2
Notes:[list=1][*]In this example, the volume named Yoda would not be mounted by MacOS X's autodiskmount.
[*]Putting a dot at the start of a volume name ensures the volume is not visible in the Finder. One would think that this would be moot if the volume is not mounted in /Volumes, but it seemed to me the volume could show up under certain circumstances. But i won't swear to that, so YMMV.
[*]The swap volume mount � in theory � should work, however in practice (as i recall) it is not reliable (most likely because the VM system sometimes comes online before the volumes are mounted by fstab; one should be able to restart the VM system later in the boot process to fix this, perhaps in a Startup file?) It's possible a union mount here would do the trick, however it seems to me that there was some reason, which i can't quite recall offhand, why i thought that might be a bad idea, so i'm not sure about this.
[*]Under MacOS X, referring to volumes by name is more reliable in some circumstances than by device number because, i am told, device numbers are not always consistent from boot to boot (but i suspect this is only true in the case of multiple HD's, and not true in the case of a single HD with multiple partitions). However referring to volumes by name has the disadvantage that if the volume name is changed, which the user might be able to do, then the mount point breaks.[/list=1]
     
macmike42  (op)
Senior User
Join Date: Dec 2001
Status: Offline
Reply With Quote
Apr 3, 2004, 03:23 PM
 
Wow. Thank you. It sounds like unions are just like Linux's bind option only with more sanity. No questions like "where did the files in that directory go?" In Linux (and WinXP too), this type of mount simply hides everything that was there before. It is fortunate that the last unioned path recieves writes as well.

For swap files, I could theoretically manually mount the other drive and union mount that path before vm loads, but I now that I think about it, restarting the vm system later sounds like a less sloppy (and more reliable) proposal, as long as it is still very early in the startup process.

The rc file is well known for getting replaced and screwing up everything when I get a case of the patent-pending "MacNN Software Update Mania(tm)".

A StartupItem is almost certainly the way to go, I do love that Apple built a dependency system into them, it makes them almost as useful as init scripts.

Thanks again for the insight!

/me prints this thread
"Think Different. Like The Rest Of Us."

iBook G4/1.2GHz | 1.25GB | 60GB | Mac OS X 10.4.2
Athlon XP 2500+/1.83GHz | 1GB PC3200 | 120GB | Windows XP
     
   
 
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:15 PM.
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.,