How can I create a loop-backed storage pool in a custom directory?

I would like to create a loop-backed btrfs-formatted storage pool, but in a directory of my choosing. The default dumps it in /var/snap/lxd/common/lxd/disks/, and specifying source= seems to expect an existing filesystem.

Yeah, this isn’t supported as it makes our lives pretty hard in some cases (especially because of the snap mount handling).

If you can instead use a disk partition, that’s far cleaner and faster. If that’s not an option, then you have two ways around this:

  • Create and mount the loop yourself through your host’s /etc/fstab, then feed that path to LXD as a source=
  • Override where the LXD generated disks go by bind-mounting another path over /var/snap/lxd/common/lxd/disks (requires a reboot to work)

Ah, that’s unfortunate, but fair enough. Thank you.