0

I just tried to use btrfs send for a backup but it ended up giving me an io error. I ran btrfs scrub, which reported 32 unrepairable blocks on my raspi's sd card.

The obvious way to fix this is to get fresh copies of the affected files, but how do you find out which files they are?

Everywhere I've looked online, wikis and people only ever mention that you can do a scrub and that typically everything ends well if you have raid, not how to get to the next step after being told there are errors.

  • I hope you can get this information from Btrfs; but in case you can't, this answer says you can verify a single file just by reading it. Worst case scenario is you read all files one by one. – Kamil Maciorowski Sep 16 '18 at 18:35
  • Yes, there is that, but... just as you posted this, I actually found an answer. – Marnes Sep 16 '18 at 22:01
0

Turns out dmesg will list all btrfs checksum errors with file paths after a scrub. Run
dmesg --clear btrfs scrub start -B / dmesg
to get a rough overview of the bad files.

  • 1
    pitfall: the dmesg entries list corrupt files by their simple path. Deleting those files, followed by scrubs, syncs, and fstrims, didn't remove the errors. The cause was snapshots still referencing the bad blocks, which wasn't obvious from the messages. Deleting the snapshots as well finally removed all errors. – Marnes Sep 16 '18 at 22:31

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.