Access orphaned storage volume

I have an orphaned storage volume, default.img, that contains several instances:

bash 5.0 :) sudo file default.img 
default.img: BTRFS Filesystem label "default", sectorsize 4096, nodesize 16384, leafsize 16384, UUID=16f188ec-2dea-4c57-9309-92d9a457b3f4, 15763156992/19999997952 bytes used, 1 devices

But when I tried to add it to lxd, I get

bash 5.0 :) lxc storage create old.default btrfs source=/path/to/default.img 
Error: Provided path does not reside on a btrfs filesystem

But when I set up the volume as a loop device, I get

bash 5.0 :) lxc storage create old.default btrfs source=/dev/loop22
Error: Failed to format block device: Failed to run: mkfs.btrfs -L old.default /dev/loop22: /dev/loop22 appears to contain an existing filesystem (btrfs).
ERROR: use the -f option to force overwrite of /dev/loop22

What’s the proper way of setting up this volume and access containers within?

Turned out pretty easy:

lxc storage volume import default /path/to/default.img 
1 Like