LXC mount zfs filesystem

altano

Well-Known Member
Apr 6, 2019
58
17
48
41
California, US
alan.norbauer.com
I have a zfs pool on the host Proxmox system:

Code:
# zpool list
NAME    SIZE  ALLOC   FREE  CKPOINT  EXPANDSZ   FRAG    CAP  DEDUP    HEALTH  ALTROOT
...
zslow   131T  38.2T  92.7T        -         -     0%    29%  1.00x    ONLINE  -

I have the pool loaded and I've mounted a filesystem:
Code:
# zfs list
NAME                     USED  AVAIL  REFER  MOUNTPOINT
...
zslow/sync/videos       20.3T  65.8T  20.3T  /mnt/zslow/sync/videos

How do I mount /mnt/zslow/sync/videos into an lxc?

I've tried:

1. Using the GUI (Resources -> Add -> Mount Point) which didn't show me the zpool.
2. Creating a "Directory" in Datacenter storage and then using the GUI again. This just created a new disk and mounted it, which isn't what I want.
3. Using the CLI, with a lot of options:
Code:
pct create 300 ... --mp0 "volume=zslow/sync/videos,mp=/mnt/zslow/sync/videos,ro=1,backup=0,acl=0,mountoptions=noatime,replicate=0"
# unable to parse volume ID 'zslow/sync/videos'

pct create 300 ... --mp0 "volume=zslow,mp=/mnt/zslow/sync/videos,ro=1,backup=0,acl=0,mountoptions=noatime,replicate=0"
# unable to parse volume ID 'zslow'

pct create 300 ... --mp0 "volume=videos,mp=/mnt/zslow/sync/videos,ro=1,backup=0,acl=0,mountoptions=noatime,replicate=0"
# unable to parse volume ID 'videos'

pct create 300 ... --mp0 "volume=/zslow/sync/videos,mp=/mnt/zslow/sync/videos,ro=1,backup=0,acl=0,mountoptions=noatime,replicate=0"
# Creating filesystem with 33554432 4k blocks and 8388608 inodes
# Filesystem UUID: 9b5efa0e-f4c3-412d-9ef7-13644d60ac49
# Superblock backups stored on blocks:
#     32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
#    4096000, 7962624, 11239424, 20480000, 23887872
# mounting container failed
#  Logical volume "vm-300-disk-0" successfully removed.
# unable to create CT 300 - directory '/zslow/sync/videos' does not exist

How do I take this zfs filesystem and mount it into an LXC? I just need to access the files read-only so I don't even need to mess with ACLs?
 
Last edited:
volume is the path of the directory on the host
mp is the target path within the lxc.
command like that should work:

pct create 300 ... --mp0 "volume=/mnt/zslow/sync/videos,mp=/mnt/videos,ro=1,backup=0,acl=0,mountoptions=noatime,replicate=0"
 
  • Like
Reactions: ccj47