Zfs mirror for lxd


I would like to install lxd on a Ubuntu Server 20.04 on my Server with 2 HDD’s. I already installed Ubuntu and md0 for /boot and md1 for /. Now I woule like to use zfs (mirror) for LXD.

I already created the zfs mirror via “zpool create zroot-lxd /dev/sda5 /dev/sdb5” but I don’t know how I could use it when I use it via lxd init.

Does anyone know what is the best way to use LXD with zfs for 2 HDD via zfs mirror ?

BR Kohlrabiherold

stgraber@castiana:~$ lxd init
Would you like to use LXD clustering? (yes/no) [default=no]: 
Do you want to configure a new storage pool? (yes/no) [default=yes]: 
Name of the new storage pool [default=default]: blah
Name of the storage backend to use (ceph, btrfs, dir, lvm, zfs) [default=zfs]: 
Create a new ZFS pool? (yes/no) [default=yes]: no
Name of the existing ZFS pool or dataset: 

Then at that point give zroot-lxd if you want the whole pool used or zroot-lxd/lxd if you want LXD to operate within a dataset called lxd on your pool instead.

1 Like

Hello stgraber,

thank you very much for your hint. That worked perfectly.

One additional question just for information. Why do I need a new storage pool (where you typed in “blah”. I already have the zroot-lxd and I am not able to find the name I gave when I use a zfs-list.

That’s because LXD has storage pools of its own with their own names distinct from whatever they may be called in their respective storage backends (some backends don’t the concept of pools at all).

So the name you pick in lxd init is what shows up in lxc storage list

1 Like