The situation that I've found myself in is that I'm having to run Fedora Linux from a semi-read-only location. I can make edits to the file system, placing files and such, but all is lost on reboot, and as an added hassle, I cannot easily increase the available storage space either. I do have access to some writable media though, so I thought I'd do this:
sudo mount --bind /usr /home/username/Store/Orig/usr
sudo mount -t overlay ovl_usr -o lowerdir=/usr,upperdir=/home/username/Store/usr,workdir=/home/username/Store/Work/usr /usr
The second line works okay, it's the first line that isn't working. What it's meant to do is give me non-overlaid access to the original contents of /usr
. I'd expect that since the bind mount is created before the overlay is mounted on /usr
, /home/username/Store/Orig/usr
would still see the old contents. But no, /home/username/Store/Orig/usr
shows the overlaid files, just like /usr
.
Is there a way to access the original contents of /usr
?
I think you're experiencing a "shared" behavior, while you need "private". See man 8 mount
:
The shared subtrees operations.
Since Linux 2.6.15 it is possible to mark a mount and its submounts as shared, private, slave or unbindable. A shared mount provides ability to create mirrors of that mount such that mounts and umounts within any of the mirrors propagate to the other mirror. […] A private mount carries no propagation abilities. […]
Solution: after mount --bind …
and before mount -t overlay …
invoke:
sudo mount --make-private /home/username/Store/Orig/usr
この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。
侵害の場合は、連絡してください[email protected]
コメントを追加