Is there an easy way to mount a ZFS dataset into a LXD container?
I’m looking for something similar to that which mounts host directories:
lxc config device add mycontainer mystorage disk source=/srv/mydata path=/srv/mydata/
But with a source dataset instead of a source path:
lxc config device add mycontainer mystorage disk source=zfs:mypool/storage path=/mnt/storage/
I’ve read about doing something like
lxc storage create mystorage zfs source=storage/mydata
lxc storage volume create mystorage myvolume
lxc storage volume attach mystorage myvolume mycontainer path=/srv/mydata
If I create a lxd storage volume for an existing zfs dataset:
lxc storage create mystorage zfs source=storage/mydata
It creates loads of unwanted child datasets (e.g. containers
, custom
, deleted
, images
, virtual-machines
). I don’t want the dataset to be polluted with things I didn’t create myself.
What I’m looking for is a simple way to attach a ZFS dataset that is otherwise unmounted (i.e. it has ‘mountpoint=none’ and is not mounted on the host or any other container), directly without needing a lxd storage pool. Is this possible?