Re: Accessing bind mount in lower layer via overlayfs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Mar 12, 2024 at 8:13 PM Raul Rangel <rrangel@xxxxxxxxxxxx> wrote:
>
> Hello,
> I was wondering if it was possible for the bind mounts created under a
> lower layer to be exposed via overlayfs?
>
> I have attached a test script that reproduces what I'm trying to achieve:
> $ unshare --user --map-root-user --mount bash -xe mount-test
> + mkdir -p real/usr/lib
> + touch real/usr/lib/foo
>
> + mkdir -p stage/input
> + mount --bind real stage/input <-- I want to mount `real` under `input`.
> + ls -l stage/input
> drwxr-xr-x 3 root root 4096 Mar 12 11:53 usr <-- `usr` is visible.
>
> + mkdir work upper merged
> + mount -t overlay overlay
> -olowerdir=./stage,upperdir=./upper,workdir=./work ./merged
> + ls -Rl merged/input
> merged/input:
> total 0 <-- The `usr` directory is not passed through.
>
> I wasn't able to find anything that explicitly states it's not
> supported. Is something like this possible? I tried setting the mount
> propagation to shared, but that didn't have any effect.

Overlayfs does not follow children (bind) mounts.

It looks like you are trying to overlay the tree at real over
the tree in stage/input.
Why not use an overlayfs layer of real on top of the stage
layer?

Please explain what you want to achieve rather than how
you tried to achieve it, so maybe I can help more.

Thanks,
Amir.





[Index of Archives]     [Linux Filesystems Devel]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux