I want to share the results of me trying to mount multiple zvols in an lxc container to share them using smb/nfs/sftp
The command outputs are trimmed to only include the relevant parts.
Goal:
Gounting ZFS-Pool into lxc Container.
Prerequisites
While researching I found 2 ways to do it.
The command outputs are trimmed to only include the relevant parts.
Goal:
Gounting ZFS-Pool into lxc Container.
Prerequisites
- Proxmox VE 8.2.2
- Container 102 (to mount to)
- A Zpool
Code:$ zfs list NAME MOUNTPOINT tank /tank tank/zvolA /tank/zvolA tank/zvolB /tank/zvolB
While researching I found 2 ways to do it.
- Mount point
Mount points are the Proxmox way of mounting local folders inside a container and should always be preferred. Sadly mount points do not support recursive mounts so we have to add a line for each zvol.
Code:$ cat /etc/pve/lxc/102.conf mp0: /tank,mp=/mnt/tank mp1: /tank/zvolA,mp=/mnt/tank/zvolA mp2: /tank/zvolB,mp=/mnt/tank/zvolB
- lxc.mount.entry
for mounting all zvols using a single line we can use lxc.mount.entry
Code:$ cat /etc/pve/lxc/102.conf mp0: /mnt,mp=mnt/tank lxc.mount.entry: /tank mnt/tank none rbind 0 0
The first line is only needed at the first start. There are some steps the mount point does that lxc.mount.entry don't.
In the container the second line gets mounted.