linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Recovering suddenly corrupt Btrfs partition?
@ 2022-09-23  5:16 Daniel Trescott
  2022-09-24 19:58 ` Mihai Lazarescu
  0 siblings, 1 reply; 2+ messages in thread
From: Daniel Trescott @ 2022-09-23  5:16 UTC (permalink / raw)
  To: linux-btrfs

Hello all,

I've got a Fedora boot disk that seems to have had its Btrfs root
filesystem corrupted suddenly. I pulled that disk out and put it into
another machine, and I can't get it to mount read only, complaining of
a bad superblock. I ran `btrfs check --readonly` on the drive and it
started spewing errors saying there were errors found in the
filesystem roots.

If anyone could please advise me on how to get the partition into a
usable read-only state, I'd be extremely grateful. Thank you!

Best regards,
Daniel

`uname -a`:
Linux <hostname> 5.19.9-200.fc36.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Sep
15 09:49:52 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

`btrfs --version`:
btrfs-progs v5.18

`dmesg` when attempting to mount partition:
[ 8613.285696] BTRFS info (device sda3): disk space caching is enabled
[ 8613.285700] BTRFS info (device sda3): has skinny extents
[ 8613.288986] BTRFS info (device sda3): bdev /dev/sda3 errs: wr 0, rd
0, flush 0, corrupt 4, gen 0
[ 8613.327357] BTRFS info (device sda3): enabling ssd optimizations
[ 8613.327364] BTRFS info (device sda3): start tree-log replay
[ 8613.636194] BTRFS error (device sda3): parent transid verify failed
on 66931867648 wanted 541837 found 541832
[ 8613.636204] BTRFS: error (device sda3) in btrfs_replay_log:2500:
errno=-5 IO failure (Failed to recover log tree)
[ 8613.657624] BTRFS error (device sda3: state E): open_ctree failed

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Recovering suddenly corrupt Btrfs partition?
  2022-09-23  5:16 Recovering suddenly corrupt Btrfs partition? Daniel Trescott
@ 2022-09-24 19:58 ` Mihai Lazarescu
  0 siblings, 0 replies; 2+ messages in thread
From: Mihai Lazarescu @ 2022-09-24 19:58 UTC (permalink / raw)
  To: linux-btrfs

On Thursday, September 22, 2022 at 22:16:33 -0700, Daniel Trescott wrote:

> If anyone could please advise me on how to get the partition into a
> usable read-only state, I'd be extremely grateful. Thank you!

> [ 8613.636194] BTRFS error (device sda3): parent transid verify failed
> on 66931867648 wanted 541837 found 541832

Important disclaimer: I'm only a user, not developer. I just 
share my own experience, without any deeper knowledge of BTRFS.

"parent transid verify failed" is what I got (then I discovered 
that the disk also had bad sectors).

First think first, I strongly recommend you to do a byte-by-byte 
copy (image) of the full faulty disk. You can use dd or, if you 
have bad or unreliable sectors, ddrescue is doing a much better 
job (can install it with dnf).

In my case I could not mount the disk, not even with the second 
or third superblock copy.

So I used

btrfs-find-root /dev/...

to discover potential root candidates, then I used

btrfs restore -m -S -i -t <id> /dev/... <some_dir_with_enough_free_space> 2>&1 | grep -v '^trying another mirror$' | tee btrfs-restore.log

with <id> the highest that works.

My BTRFS FS was plain (no snapshots, etc.). Here are some 
additional details: https://btrfs.wiki.kernel.org/index.php/Restore

Hope this helps.

Mihai

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-09-24 20:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-23  5:16 Recovering suddenly corrupt Btrfs partition? Daniel Trescott
2022-09-24 19:58 ` Mihai Lazarescu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).