I was able to convince LXD to use a pre-existing btrfs subvol by
mounting it to /var/lib/lxd/storage-pools/<name>, creating the folder
structure by hand and inserting the rows into the sqlite manually:
# lxd sql global "insert into storage_pools (name, driver, description,
state) values ('lxd', 'btrfs', '', 1);"
# lxd sql global "insert into storage_pools_config (storage_pool_id,
node_id, key, value) values (9, 1, 'source',
'/dev/disk/by-uuid/038ce7f2-8a2c-4b26-a71a-ec1493ac7696');"
# lxd sql global "insert into storage_pools_config (storage_pool_id,
node_id, key, value) values (9, 1, 'volatile.initial_source',
'/dev/disk/by-uuid/038ce7f2-8a2c-4b26-a71a-ec1493ac7696');"
# lxd sql global "insert into storage_pools_config (storage_pool_id,
node_id, key, value) values (9, 1, 'btrfs.mount_options', 'subvol=lxd');"
This seems to work as it survived multiple reboots and I was able to
migrate containers to the new storage pool with "lxc move".
Regards,
Marcel
Am 20.09.2021 um 11:49 schrieb Brian Candler:
> I don't use btrfs that way myself, but the documentation here
> <
https://linuxcontainers.org/lxd/docs/master/storage#btrfs> says:
>
> * Create a new pool called "pool1" using an existing btrfs