Hi, I did a rebuild of the server I was using to run LXD containers on. The LXD storage pool is a BTRFS pool from block storage, which is essentially just an LVM volume with a BTRFS filesystem on it. I rebuild the root filesystem and want to use the existing LXD storage pool still available.
The storage pool name: containers
The storage pool logical volume location: /services/lxd
How do use an existing BTRFS storage pool which is a logical volume or block device?
I need to rebuild this server tonight and I really need your assistance. Please let me know if there is any further information you require in order to assist me?
You shouldn’t use lxc storage create before lxd import. It will fail due to the source not being empty.
Instead you need to enter the snap’s mount namespace and mount the storage pool where it once was under /var/snap/lxd/common/lxd/storage-pools.
So first nsenter --mount /run/snapd/ns/lxd.mnt and then from that shell mount -o bind /services/lxd /var/snap/lxd/common/lxd/storage-pools/default/ assuming the store pool was called default, otherwise change as needed.
Once it’s mounted there, lxd import should behave properly and will recreate the storage pool in the database when importing its first container.