1

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
Martian2020
  • 1,167
  • 2
    "The bind mount call attaches only (part of) a single filesystem, not possible submounts." ... Read that with the implied "at the time of mounting" – muru Dec 02 '21 at 22:11

0 Answers0