This one time, at band camp, Giacomo Mulas said: > Question (request for help?): it would be extremely useful if bind-mounted > directories could keep track of filesystems subsequently mounted, and > keep things in sync automatically. Perhaps not as the default behaviour, > but at least as an option. In this way, if I bind-mount /media to something > in a chroot jail, I will automatically be able to access subsequently > mounted filesystems under it from within the jail. Where would this need to > be supported? In libc? In the kernel? Both? Would it be > better/cleaner/simpler to have an user space daemon (i.e. something like > famd) monitor some directories and automatically bind-mount and unmount > their contents as needed? I am willing to invest a little time on this > thing, but I am no kernel hacker and never messed with the libc, although I > am a decent programmer, therefore I would definitely need help.
I think you are going about it wrong, or looking at it backwards, or something. It may be helpful to note that filesystems are mounted _over_ an existing mount point, not under. So, if you have two directories: /media/pendrive /ia32/media/pendrive and you bind mount /media/pendrive onto /ia32/media/pendrive, you get exactly what is in /media/pendrive *right now*. When you later mount the actual pendrive _over top_ of /media/pendrive, it does nothing to what's underneath of it, and so the bind mount is unaffected. So, all that being said, your solution is actually not a bad one, and seems to work. If you want an easier to maintain setup, the only thing I can think off the top of my head would be a) hard linking the directory one level up (e.g., /media), this will of course only work if they are on the same file system. b) an automounter arrangement that mounted the removable/network media in both places. This seems slightly more difficult, but doesn't on the face of it, seem impossible. -- ----------------------------------------------------------------- | ,''`. Stephen Gran | | : :' : [EMAIL PROTECTED] | | `. `' Debian user, admin, and developer | | `- http://www.debian.org | -----------------------------------------------------------------
signature.asc
Description: Digital signature