Linux Btrfs filesystem development
 help / color / mirror / Atom feed
* Fixing a corrupted file system
@ 2026-04-01 15:58 Amit Shah
  2026-04-01 21:21 ` Qu Wenruo
  0 siblings, 1 reply; 10+ messages in thread
From: Amit Shah @ 2026-04-01 15:58 UTC (permalink / raw)
  To: linux-btrfs

Hello folks,

I had a msata drive that started showing signs of failure - error
reading sectors.  I had a single LUKS partition on it (for encryption)
with btrfs as the file system taking up the entire space (1 TB).

I got all the raw data from the drive via ddrescue, and have dumped it
into a second drive.  However, it looks like before I noticed the disk
errors, btrfs tried correcting them based on the erroneous reads on the
first disk, causing those errors to propagate on the recovered copy:

# mount /dev/mapper/luks-ad4cc8e3-17c1-41f8-8d9d-bb831bfcef23
/mnt/msatassd/
mount: /mnt/msatassd: can't read superblock on /dev/mapper/luks-
ad4cc8e3-17c1-41f8-8d9d-bb831bfcef23.
       dmesg(1) may have more information after failed mount system
call.

# dmesg|tail
[960464.502742] BTRFS: device label msatafs devid 1 transid 772442
/dev/mapper/luks-ad4cc8e3-17c1-41f8-8d9d-bb831bfcef23 scanned by mount
(10021)
[960464.516714] BTRFS info (device dm-0): first mount of filesystem
28fa4955-eadf-4f12-a34d-fb7405bbd0a5
[960464.526014] BTRFS info (device dm-0): using crc32c (crc32c-generic)
checksum algorithm
[960464.534065] BTRFS info (device dm-0): disk space caching is enabled
[960464.559255] BTRFS info (device dm-0): bdev /dev/mapper/luks-
ad4cc8e3-17c1-41f8-8d9d-bb831bfcef23 errs: wr 0, rd 0, flush 0, corrupt
100, gen 0
[960464.607016] BTRFS error (device dm-0): bad tree block start, mirror
1 want 1116258304 have 5031253079992706228
[960464.617170] BTRFS error (device dm-0): failed to read block groups:
-5
[960464.626009] BTRFS error (device dm-0): open_ctree failed: -5


(I also have the raw file that I can loop-mount instead of using this
other drive, but for this experiment, working on the drive is simpler
to iterate.)

So questions:

1. Can I do anything to fix the metadata for this filesystem, and have
it mount, recognize and recover the data on there?

2. Does it make sense to drop down the filesystem to read-only when the
underlying drive starts exhibiting errors?

Thanks,
		Amit

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

end of thread, other threads:[~2026-04-24 18:16 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-01 15:58 Fixing a corrupted file system Amit Shah
2026-04-01 21:21 ` Qu Wenruo
2026-04-02 18:18   ` Amit Shah
2026-04-02 18:32   ` remi
2026-04-02 18:52     ` Amit Shah
2026-04-02 19:07     ` Forza
2026-04-24  8:23       ` Ulli Horlacher
2026-04-24 12:49         ` Roman Mamedov
2026-04-24 18:10           ` How to corrupt a btrfs fs [was Re: Fixing a corrupted file system] Nicholas D Steeves
2026-04-24 18:16             ` Roman Mamedov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox