Few questions about zvols on LXD manged ZFS pools


I have some stuff doesn’t like ZFS so have to use another file system within a container, so have to use zvol, and this answer works fine:

Question 1:
Any problems of this zvol sitting on a LXD managed ZFS pool in the same structure as lxd created block volumes, e.g.
and then for the instance > config > device > source:

Question 2:
Is there a difference between the zfs block volume when created via lxc storage volume create... --type block command, and a zvol created via zfs ?

Question 3:
I see devices created by lxc and zfs commands below /dev/zvol, however I’m not permitted to attach a LXD block device to a container (only for non zfs compatible stuff), but I can attach the zvol created with zfs. Is this intended?


If manually created, it’d be better to put it at lxdpool00/my-zvol/something just to avoid potential name conflicts down the line.

Nope, we create a zvol internally for --type block.

You can attach it as a mounted disk using disk type and then pool=your-pool and source=your-volume. If you just want to see it exposed as /dev/sdX, then this isn’t currently possible. We have https://github.com/lxc/lxd/issues/10077 for that.

Good morning and thank you for your quick and helpful response.

I’m going to mark you response above as the solution. I’ll add to #10077.

Just for the record, a good example of a use case is something like Docker, and there are others mentioned in this great site that also don’t like ZFS or a different file system is recommended, so currently have to:

  1. create a zvol via zfs,
  2. format to xfs or ext4, mount and chown 1000000:1000000 it
  3. added to the container type Ubuntu 22.04 instance and mounted at:
  4. within the container, docker directories are then bind mounted from this disk to the default locations via fstab:
    /mnt-acme/disk01/docker/var/lib/docker /var/lib/docker...