Issues creating btrfs storage pools with image files in non-standard locations

Hi there,

I’m trying to set up some extra btrfs storage pools where the btrfs filesystems are backed by files that I keep on an external drive - i.e., they aren’t physical disks or disk partitions, and the image files reside outside the usual auto-create spot of /var/snap/lxd/common/lxd/.

If I try and create a pool by pointing to the backing file, I get this:

$ lxc storage create external-1 btrfs source=/mnt/data/lxc-container-storage.btrfs.img
Error: Provided path does not reside on a btrfs filesystem (detected 0x2011bab0)

Previously (some months ago, presumably on an earlier LXD version), I was able to create a pool by instead mounting the disk image and pointing to the mounted filesystem.
However if I try this now now get this:

# /mnt/data/lxc-container-storage.btrfs.img now mounted via loopback device at /mnt/lxc-external/
$ lxc storage create external-1 btrfs source=/mnt/lxc-external/
Error: Could not determine if existing btrfs subvolume is empty: "/var/lib/snapd/hostfs/mnt/lxc-external/" is outside pool mount path "/var/snap/lxd/common/lxd/storage-pools/external-1"

Is there any way I can work around this? or is it something that’s likely going to need to be fixed in the LXD source? (I took a quick look myself but hit a bit of a wall between the client and server sides of the codebase…)

I am running LXD 5.19 via snapcraft on Debian 11

P.S. after finding my way to this support area, it was really confusing working out I had to do the whole “read for 10 minutes before you can post” thing. I was only able to indirectly work it out by finding replies in other threads talking about being unable to post, which seems very roundabout… I’m sure others have complained too but just adding my voice to the pile. I imagine there may not be much you can change if Discourse is an external service but there should really be some clearer lockout message in the UI to indicate you are in a mode that’s not allowed to post yet.

Sounds like you’ve been affected by

This will be included in LXD 5.20.

As this is a regression I’ll cherry-pick into LXD latest/stable channel to get it fixed before LXD 5.20 is released.

This has been cherry-picked and will build into lastest/candidate soon: