Hey all! I have a work around for the above, but I would like some help understanding why the workaround is necessary. I’m trying to better understand the inner workings. All my research leads me to file permissions and (un)priveledged containers, both of which I have ruled out.
Issue:
If I bind mount a top level directory to an LXC, then no process within can recursively see inside nested ZFS datasets, but can do so with directories.
The work around is to create multiple bind mounts for each sub directory and dataset, but I am not sure why this works.
Example:
Host:
admin in ~ at lab-dl360 % zfs list
NAME USED AVAIL REFER MOUNTPOINT
test-pool 11.8T 848G 96K /test-pool
test-pool/vm 11.8T 848G 104K /test-pool/vm
test-pool/vm/test-zfs 7.49T 848G 7.49T /test-pool/vm/test-zfs
admin in ~ at lab-dl360 % mkdir /test-pool/vm/test.d
admin in ~ at lab-dl360 % touch /test-pool/vm/test.d/example.file
admin in ~ at lab-dl360 % touch /test-pool/vm/test-zfs/example.file
create any LXC. If I set the mount as such:
mp0=/test-pool/vm,/host
no process can see example.file in /host/test-zfs, but have no issues with /host/test.d
I think your work-around is as good as it gets. Each dataset is like its own file system, so nested datasets aren’t treated the same as simple directories. I’ve seen this same behavior with NFS exports on ZFS where I’ve had to mount multiple levels of datasets.
Not familiar with LXC, but with manual mount -t bind mounts you can use one of the shared/slave/rshared/rslave options to propagate child mountpoints. See man mount.
Docker has a bind-propagation option for volumes, LXC probably has a similar option.
Hopefully this gives you some terminology to search for
Thanks all! I was able to figure it out based to the suggestions here.
The solution is to change the mount point line in /etc/pve/lxc/<vmid>.conf from: mp0=/test-pool/vm,/host
to: lxc.mount.entry: /test-pool/vm host none rbind,create=dir,optional 0 0
per man mount the --rbind option is needed to recursively bind-mount nested filesystems.
Unfortunately Proxmox’s PCT tool does not seem to support this with the mp0=xzy syntax in the conf file. It will take the standard LXC option entries though, which is what I did above.
Thanks for the help, and I hope this helps someone else avoid this headache in the future.