Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I have a filesystem tree (could be one partition on /, or several partitions making up the whole filesystem). Now I want to mount another partition somewhere on top of it (like we can do already- sorta), say on /usr. Instead of hiding the entire contents of /usr with the new mount, I want to be able to see (and possibly modify) the would-be-hidden files, IF there is no corresponding file on the new mount. All new files should be added to the last mounted drive.
This would be most useful for the current setup with the Sharp Zaurus (linux pda). It's only got 32mb on board memory, so most ppl add apps to their sd card. Rather than having to link all these files and therefore overwrite exisiting files on board which are upgraded (and make the sd umountable- very inconvienient), we could transparently mount the sd on top of the on board memory.
Does anyone know if this is already possible? I did find a couple of messages on the kernel mailing list, but thats all. It doesn't help that I don't really know what to call this.
at this point to the best of my knowledge there is no way to do this, when you mount a drive/memcard that is all you will see at that mount point if there is something in that folder before you mount, once you mount that drive, as far as the kernel/system is concerned those files that were originally in the folder do not exist.
Doesn't bind just mount the same part in two places? There is no indication that this gives any different behaviour from normal mounts, so it would still hide the existing contents (or it would have to be mounted somewhere else- which is back to square 1).
read the man page again. you can mount on top of an already mounted partition and effectivly bind the two into one collective mount. I mount bind multi mounts into /dev/shm all the time.
you can do a lot with bind mounts. u could say bind the file /usr/tammy into /jammy and then bind the file /opt/wammy into /jammy. Then go into /jammy and see tammy and wammy in there.
Of course you have to write a script to weed out what files already exist in wammy so you wont overwrite jammy or tammy if it is already in there.
I gave it a try, but it seems that it doesn't work.
Firstly, it won't let me bind a file somewhere else (not that that is what I want to do anyway). I just says:
mount: Not a directory
Secondly, if I bind a directory on top of another directory it hides the previous contents, just like I thought it would before.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.