Skip to content

LXD with ZFS

When you already have a working ZFS pool (see here) and want to use LXD - it is good idea to configure them together.

Step 1 - Prepare filesystem

sudo zfs create -o mountpoint=none mypool/lxd-pool

Step 2 - Install LXD

sudo apt install lxd

You might want this:

sudo usermod -aG lxd <your-username>

Step 3 - Configure LXD

sudo lxc init

Configure ZFS this way:

Do you want to configure a new storage pool (yes/no) [default=yes]?  yes
Name of the new storage pool [default=default]:
Name of the storage backend to use (dir, btrfs, ceph, lvm, zfs) [default=zfs]: zfs
Create a new ZFS pool (yes/no) [default=yes]? no
Name of the existing ZFS pool or dataset: mypool/lxd-pool
[...]

Step 4 - Optional

If you use zfs-auto-snapshot, you might want to consider this:

sudo zfs set com.sun:auto-snapshot=false mypool/lxd-pool
sudo zfs set com.sun:auto-snapshot=true mypool/lxd-pool/containers
sudo zfs set com.sun:auto-snapshot=true mypool/lxd-pool/custom
sudo zfs set com.sun:auto-snapshot=true mypool/lxd-pool/virtual-machines

Page contributed by michabbs

Reference Armbian Forum Dicussion


Last update: December 23, 2020

Comments