This is the output of nsenter --mount=/run/snapd/ns/lxd.mnt /snap/lxd/current/bin/btrfs scrub start /var/snap/lxd/common/lxd/storage-pools/default
WARNING: cannot create scrub data file, mkdir /var/lib/btrfs failed: Read-only file system. Status recording disabled
WARNING: failed to open the progress status socket at /var/lib/btrfs/scrub.progress.37ab66ba-6522-43ce-adcc-024792370708: No such file or directory. Progress cannot be queried
scrub started on /var/snap/lxd/common/lxd/storage-pools/default, fsid 37ab66ba-6522-43ce-adcc-024792370708 (pid=15417)
Ok, so the entire filesystem went offline and is now readonly due to this issue.
Easiest at this stage is most likely to stop LXD and any related process, unmap the loop device, then run btrfsck against the loop file to figure out what’s going on.
i stopped lxd and killed related processes and unmapped the loop device.
And ran:
btrfsck /dev/loop15
Opening filesystem to check…
ERROR: cannot open device ‘/dev/loop15’: Device or resource busy
ERROR: cannot open file system
Okay, then you probably want to use the big hammer and do snap disable lxd, then reboot the system and use btrfsck at that point when you have a clean kernel and have never tried mounting or using the btrfs volume on that boot.
btrfsck /var/snap/lxd/common/lxd/disks/default.img
Opening filesystem to check…
Checking filesystem on /var/snap/lxd/common/lxd/disks/default.img
UUID: 37ab66ba-6522-43ce-adcc-024792370708
[1/7] checking root items
[2/7] checking extents
[3/7] checking free space cache
btrfs: csum mismatch on free space cache
failed to load free space cache for block group 55864983552
btrfs: csum mismatch on free space cache
failed to load free space cache for block group 59086209024
btrfs: csum mismatch on free space cache
failed to load free space cache for block group 80561045504
[4/7] checking fs roots
[5/7] checking only csums items (without verifying data)
[6/7] checking root refs
[7/7] checking quota groups skipped (not enabled on this FS)
found 98413187072 bytes used, no error found
total csum bytes: 95433292
total tree bytes: 607059968
total fs tree bytes: 475201536
total extent tree bytes: 23707648
btree space waste bytes: 92449963
file data blocks allocated: 128041459712
referenced 114545954816
Do not use --repair unless you are advised to do so by a developer
or an experienced user, and then only after having accepted that no
fsck can successfully repair all types of filesystem corruption. Eg.
some software or hardware bugs can fatally damage a volume.
The operation will start in 10 seconds.
Use Ctrl-C to stop it.
10 9 8 7 6 5 4 3 2 1
Starting repair.
Opening filesystem to check…
Checking filesystem on /var/snap/lxd/common/lxd/disks/default.img
UUID: 37ab66ba-6522-43ce-adcc-024792370708
[1/7] checking root items
Fixed 0 roots.
[2/7] checking extents
No device size related problem found
[3/7] checking free space cache
cache and super generation don’t match, space cache will be invalidated
[4/7] checking fs roots
[5/7] checking only csums items (without verifying data)
[6/7] checking root refs
[7/7] checking quota groups skipped (not enabled on this FS)
found 98413187072 bytes used, no error found
total csum bytes: 95433292
total tree bytes: 607059968
total fs tree bytes: 475201536
total extent tree bytes: 23707648
btree space waste bytes: 92449963
file data blocks allocated: 128041459712
referenced 114545954816