Adding a new storage pool

I have linode which host lxd (the machine run on ubuntu 22.04)
I provisionned a new volume 100GB and attached to the linode instance
I want to use that volume as storage pool (btrfs or zfs)
so can you show me how to do so?
Thanks in advance

You can do lxc storage create <pool name> zfs source=/dev/<volume device>.

This will create a ZFS pool on the device.

Then you can launch instances on it using lxc launch <name> <image> --storage <pool name>

2 Likes

Also see https://documentation.ubuntu.com/lxd/en/latest/howto/storage_volumes/ :slight_smile:

1 Like

After updating to the latest HWE kernel (6.5) in 22.04 new ZFS pools are created with a new feature set (should be ZFS 2.2). Is there any way to specify compatibility when creating storages via lxc? Or is there a way to use the ZFS 2.1 tooling explicitly to create a new pool?

I see the following additional features on the new (2.2) pool:

default  unsupported@org.openzfs:zilsaxattr          readonly                                    local
default  unsupported@com.delphix:head_errlog         readonly                                    local
default  unsupported@org.openzfs:blake3              inactive                                    local
default  unsupported@com.fudosecurity:block_cloning  readonly                                    local
default  unsupported@com.klarasystems:vdev_zaps_v2   readonly   

Figured it out how to do it:

truncate -s 512G /var/snap/lxd/common/lxd/disks/default_legacy.img
zpool create -m none -O compression=on -o compatibility=openzfs-2.0-linux default_legacy /var/snap/lxd/common/lxd/disks/default_legacy.img
zpool set autotrim=on default_legacy
lxc storage create default_legacy zfs source=default_legacy

Seems to work fine so far.

Thanks!

@sdeziel1 do you think it may be useful to support the compatibility option when LXD is creating ZFS pools?

@tomp, yes, I think it make sense but would likely require some work on the snap as we don’t have those compat feature list files in the snap.

Ideally, I’d like other zpool properties (-o) and file system properties (-O) to be configurable as well. -O compression=zstd would probably benefit a few.

That would indeed be very nice!

Wanna create an issue for this to track it?

https://github.com/canonical/lxd/issues/13168

1 Like

In case someone is wondering, the main reason for this were the crashes we were seeing related to ZFS 2.2 features: https://github.com/openzfs/zfs/issues/15984

2 Likes