I've created an image of the root while it was read-only and tried to repair that: # btrfs rescue zero-log sysroot.img Clearing log on sysroot.img, previous log_root 0, level 0 # btrfs rescue chunk-recover sysroot.img Scanning: DONE in dev0 We are going to rebuild the chunk tree on disk, it might destroy the old metadata on the disk, Are you sure? [y/N]: y Chunk tree recovered successfully Gertrud:~ # btrfs check sysroot.img Checking filesystem on sysroot.img UUID: 95cadcea-1e91-4624-aab9-859ea02ad06f Chunk[256, 228, 543533039616] stripe[1, 60167290880] is not found in dev extent Chunk[256, 228, 562659065856] stripe[1, 81642127360] is not found in dev extent Chunk[256, 228, 568094883840] stripe[1, 62314774528] is not found in dev extent Chunk[256, 228, 569336397824] stripe[1, 67683483648] is not found in dev extent Chunk[256, 228, 575509364736] stripe[1, 42987421696] is not found in dev extent Chunk[256, 228, 577656848384] stripe[1, 58019807232] is not found in dev extent Chunk[256, 228, 585844129792] stripe[1, 69830967296] is not found in dev extent Chunk[256, 228, 615316979712] stripe[1, 6614417408] is not found in dev extent ref mismatch on [638004637696 143360] extent item 2, found 3 Backref 638004637696 root 282 owner 30677 offset 0 num_refs 0 not found in extent tree Incorrect local backref count on 638004637696 root 282 owner 30677 offset 0 found 1 wanted 0 back 0x19ccd40 Backref bytes do not match extent backref, bytenr=638004637696, ref bytes=143360, backref bytes=880640 backpointer mismatch on [638004637696 143360] ref mismatch on [638048546816 4096] extent item 0, found 1 Backref 638048546816 root 282 owner 30689 offset 0 num_refs 0 not found in extent tree Incorrect local backref count on 638048546816 root 282 owner 30689 offset 0 found 1 wanted 0 back 0xba78b10 backpointer mismatch on [638048546816 4096] checking free space cache checking extentscache and super generation don't match, space cache will be invalidated checking fs roots checking csums checking root refs checking quota groups ERROR: out of memory ERROR: Loading qgroups from disk: -2 found 34938126339 bytes used err is 0 total csum bytes: 28927260 total tree bytes: 1704460288 total fs tree bytes: 1593638912 total extent tree bytes: 68534272 btree space waste bytes: 246374393 file data blocks allocated: 846205018112 referenced 95776739328 extent buffer leak: start 141427359744 len 16384 extent buffer leak: start 141426868224 len 16384 btrfs check --repair sysroot.img enabling repair mode Checking filesystem on sysroot.img UUID: 95cadcea-1e91-4624-aab9-859ea02ad06f Chunk[256, 228, 543533039616] stripe[1, 60167290880] is not found in dev extent Chunk[256, 228, 562659065856] stripe[1, 81642127360] is not found in dev extent Chunk[256, 228, 568094883840] stripe[1, 62314774528] is not found in dev extent Chunk[256, 228, 569336397824] stripe[1, 67683483648] is not found in dev extent Chunk[256, 228, 575509364736] stripe[1, 42987421696] is not found in dev extent Chunk[256, 228, 577656848384] stripe[1, 58019807232] is not found in dev extent Chunk[256, 228, 585844129792] stripe[1, 69830967296] is not found in dev extent Chunk[256, 228, 615316979712] stripe[1, 6614417408] is not found in dev extent ref mismatch on [638004637696 143360] extent item 2, found 3 attempting to repair backref discrepency for bytenr 638004637696 Backrefs don't agree with each other and extent record doesn't agree with anybody, so we can't fix bytenr 638004637696 bytes 143360 failed to repair damaged filesystem, aborting checking extents It seems the error is somewhere in the snapshots subvolume (282). I'm started from snapshot 1974 since I had to rollback a botched update some time ago, so I need to keep that or somehow create a new sysroot image that just contains the currently active files in order to replace the failed btrfs on the sysroot volume.