Recursive Mount

This is currently not supported directly.
 
I needed to bind-mount (with mpXX) everything I needed inside the LXC container to achieve what you want to do.

Another trick would be to alter the mountpoint to your lxc container, but then it is hardcoded to that VMID, but it works, too.
 
  • Like
Reactions: drumo46
@wbumiller It would be nice to get support for this

@LnxBil Thanks for the great hack, it works if I set my zfs mountpoints to be under the container's rootfs zfs mountpoint.
The only caveat is that the additional zfs can't be mounted before the container starts. It has to be mounted afterwards.
 
@wbumiller It would be nice to get support for this

Indeed.


Nowadays, you have up to 32 bind mounts in your configuration and I switched to manually putting everything in there. The configuration gets quite long, but it solved all problems ... yet I will run out of configurable mountpoints soon:

Code:
root@proxmox ~ > grep mp /etc/pve/lxc/1008.conf
mp0: /zpool/bilder,mp=/bilder
mp1: /zpool/other,mp=/other
mp10: /zpool/bilder/2003,mp=/bilder/2003
mp11: /zpool/bilder/2004,mp=/bilder/2004
mp12: /zpool/bilder/2005,mp=/bilder/2005
mp13: /zpool/bilder/2006,mp=/bilder/2006
mp14: /zpool/bilder/2007,mp=/bilder/2007
mp15: /zpool/bilder/2008,mp=/bilder/2008
mp16: /zpool/bilder/2009,mp=/bilder/2009
mp17: /zpool/bilder/2010,mp=/bilder/2010
mp18: /zpool/bilder/2011,mp=/bilder/2011
mp19: /zpool/bilder/2012,mp=/bilder/2012
mp2: /zpool/virtual_machines/VirtualBox,mp=/virtual_machines/VirtualBox
mp20: /zpool/bilder/2013,mp=/bilder/2013
mp21: /zpool/bilder/2014,mp=/bilder/2014
mp22: /zpool/bilder/2015,mp=/bilder/2015
mp23: /zpool/bilder/2016,mp=/bilder/2016
mp24: /zpool/bilder/2017,mp=/bilder/2017
mp25: /zpool/bilder/astronomy,mp=/bilder/astronomy
mp26: /zpool/filme/vdr,mp=/media
mp28: /zpool/bilder/Sonstiges,mp=/bilder/Sonstiges
mp29: /zpool/bilder/Noch_Sortieren,mp=/bilder/Noch_Sortieren
mp3: /zpool/virtual_machines/ova_templates,mp=/virtual_machines/ova_templates
mp30: /zpool/bilder/2019,mp=/bilder/2019
mp31: /zpool/bilder/2018,mp=/bilder/2018
mp4: /zpool/virtual_machines/installationsdaten,mp=/virtual_machines/installationsdaten
mp5: /zpool/bilder/198X,mp=/bilder/198X
mp6: /zpool/bilder/1992,mp=/bilder/1992
mp7: /zpool/bilder/2000,mp=/bilder/2000
mp8: /zpool/bilder/2001,mp=/bilder/2001
mp9: /zpool/bilder/2002,mp=/bilder/2002
 
Running into this issue myself. Had it happening in an unimportant container and didn't realize what was happening. Rebuilt a folder structure into multiple nested datasets and now the container that had the parent dataset mounted in and WAS working fine in is now garbage. Going to have to put in tons of mount points in the LXC config. How is something this basic not supported? Especially after being reported years ago...
 
Through a day of testing I was able to get the recursive bind mount working for nested zfs datasets by using the following mount entry line in the containers config file /etc/pve/lxc/<vmid>.conf. I'm still setting up the container but I don's see any performance or stability issues in the limited testing I've done so far.

lxc.mount.entry: /tank/dataset mnt/dataset none rbind,create=dir 0 0

tank is my zpool and dataset is a zfs dataset with other zfs datasets under it mount in the container as /mnt/dataset.

When I was using just bind in the mount entry, the lxc container was unable to start complaining it did not have permissions to mount /tank/dataset although other datasets that did not have nested datasets were able to mount in the container fine. With the rbind in the mount entry, it seems to be ok with the nested datasets and the structure including any child datasets are presented and accessible from within the container.

my proxmox version is a little out of date so hopefully this works on newer releases. pve-manager/6.1-8/806edfe1 (running kernel: 5.3.18-3-pve)
 
  • Like
Reactions: albert_a

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!