I've tried to follow the answer to Accessing contents on the underlying mount point path some time ago, it did not work. But recently I've found out it works if mount --bind
is executed after shadowing.
man mount
:
The bind mount call attaches only (part of) a single filesystem, not possible submounts.
I guess it is this feature that allows to access shadowed mount point. But why it works only if mount --bind
executed after?
Seeing new:
$ mkdir -p 1/1 2
$ touch 1/1/text
$ sudo mount --bind 1 2
$ ls 2/1
text
$ sudo mount -t tmpfs tmpfs 1/1
$ ls 2/1
$
Seeing old:
$ sudo umount 1/1
$ sudo umount 2
$ sudo mount -t tmpfs tmpfs 1/1
$ sudo mount --bind 1 2
$ ls 2/1
text