|
|
Subscribe / Log in / New account

Mount namespaces, mount propagation, and unbindable mounts

Mount namespaces, mount propagation, and unbindable mounts

Posted Mar 9, 2017 5:04 UTC (Thu) by prabhunath (guest, #114173)
Parent article: Mount namespaces, mount propagation, and unbindable mounts

# mount --bind / /opt/lxc
The above command will work, where the contents of / is visible in /opt/lxc

# mount --bind /opt/lxc /
This will not work. Any reason for this ? Neither this command fails nor the contents of /opt/lxc is visible in /


to post comments

Mount namespaces, mount propagation, and unbindable mounts

Posted Mar 9, 2017 10:33 UTC (Thu) by cortana (subscriber, #24596) [Link]

In one terminal:

$ mkdir /tmp/foo
$ cd /tmp/foo
$ touch bar
$ ls

In a second terminal:

# mount --bind /etc /tmp/foo

In the first terminal, you are still able to interact with the underlying /tmp/foo directory and its contents. Only once you cd out of the mount point does they become inaccessible.

I think you are seeing the same behaviour when you try to mount something over the root directory.


Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds