Today my desktop had a lot of hanging issues, so I tried rebooting. I noticed there were error messages about being unable to write to swap or var/cacheduring the reboot. The system then hanged on The system will reboot now! message for a minute so I tried forcing shutdown by holding the power button.
After forced shutdown, my disk seems to be unable to mount (even on Live ISO), with error `can't read superblock on /dev/nvme0n1p2`. The output from lsblk -f is
parent transid verify failed on 1166427914240 wanted 859084 found 859063 parent transid verify failed on 1166427914240 wanted 859084 found 859063 parent transid verify failed on 1166427914240 wanted 859084 found 859063 Ignoring transid failure ERROR: child eb corrupted: parent bytenr=1166426046464 item=72 parent level=2 child bytenr=1166427914240 child level=0 ERROR: failed to read block groups: Input/output error ERROR: cannot open file system
I haven’t tried running a smartctl test to avoid risking damage to the filesystem but smartctl claims that there weren’t any error messages recorded by the relevant SSD. The boot partition itself also seems fine.
Look into btrfs restore and see if you can recover some or all of your files into another medium before attempting anything further.
btrfs check is stricter and needs enough metadata integrity to open the filesystem normally, while btrfs restore uses looser checks and can often extract data as long as the metadata it needs is still readable. So a failed repair does not mean recovery is impossible; it just means the filesystem is too damaged for normal consistency checking or repair.
Anyways, is there any way of separating out by subvolume? Because it might be the case that some of my subvolumes are corrupted but my home subvolume is fine, I guess.
Please note that btrfs restore should operate on unmounted partition.
Also, if the data is critical to you, you might want to look at ways to clone your disk and work on the cloned disk rather than the actual damaged filesystem.
Would it additionally be possible to exclude certain folders? Considering most of my drive’s storage is taken up by Steam games which can be re-downloaded anyway.
Sorry for being away for a bit but I’ve been busy.
Not that I know of. I don’t think btrfs restore operates on folder level.
This is a bit of a problem because I don’t actually have any other SSDs on hand that are big enough to fit everything (~1.5TB) on the drive. Given how expensive SSDs are now I don’t think I can really afford to buy another SSD.
Regardless, I did try your advice to use an external storage medium, but I still got
like last time. Now I can force through these errors through -i but (because it looks like so much is just missing) I don’t think just copying everything through btrfs restore -i and then trying to boot from that will result in a usable system (if it even boots).
btrfs restore -l should list the root ids of the subvolumes in the btrfs partition:
I have no idea how to read this. I suppose the majority of these are corrupted snapshots. I also used the subvolumes that came default with EndeavourOS, so I believe var/cache, var/log, home, tmp, and swap are all separate subvolumes from the “main” subvolume. No clear way of figuring out which is which though.
tree key (256 ROOT_ITEM 0) 1166425276416 level 2
tree key (257 ROOT_ITEM 0) 1166407630848 level 3
tree key (258 ROOT_ITEM 0) 2622355685376 level 2
tree key (259 ROOT_ITEM 0) 1166409154560 level 1
tree key (260 ROOT_ITEM 0) 72007680 level 0
tree key (261 ROOT_ITEM 0) 72073216 level 0
tree key (265 ROOT_ITEM 0) 820229128192 level 1
tree key (266 ROOT_ITEM 64960) 364134400 level 2
This seems to be the relevant part. My CachyOS is not using the “standard” subvolume layout so I cannot unfortunately check. However my suspicion is that 256 could be @ (the root of the system) and 257, @home.
Yeah, it’s 257, but it still fails with ERROR: zstd frame incomplete. (And even then I really don’t have the storage on-hand to just write the entire home directory to any of the SSDs I own…)
OK, I did end up acquiring a 2TB hard drive that I can potentially extract to. But I still get ERROR: zstd frame incomplete when attempting btrfs restore. Is there anything I can do?