Linux Btrfs filesystem development
 help / color / mirror / Atom feed
* corruption after block-group-tree conversion, how to recover? (data is readable)
@ 2026-04-26 21:23 Thomas Debesse
  2026-04-26 22:18 ` Qu Wenruo
  0 siblings, 1 reply; 7+ messages in thread
From: Thomas Debesse @ 2026-04-26 21:23 UTC (permalink / raw)
  To: linux-btrfs; +Cc: Thomas DEBESSE

Hi, I just did a `btrfstune --convert-to-block-group-tree` conversion
operation on a btrfs filesystem and this corrupted the volume:

```
[  786.278571] BTRFS info (device dm-9): first mount of filesystem <uuid>
[  786.278595] BTRFS info (device dm-9): using crc32c (crc32c-intel)
checksum algorithm
[  786.442781] BTRFS error (device dm-9): parent transid verify failed
on logical 9820282388480 mirror 2 wanted 5715946 found 5717327
[  786.448020] BTRFS error (device dm-9): parent transid verify failed
on logical 9820282388480 mirror 1 wanted 5715946 found 5717327
[  786.449543] BTRFS error (device dm-9): failed to read block groups: -5
[  786.481199] BTRFS error (device dm-9): open_ctree failed: -5
```

I can mount the btrfs volume with `mount -oro,rescue=all`, I can
browse the filesystem, and every file data I checked loocked fine.

Here is the log when mounting with `-oro,rescue=all`:

```
[ 2523.344235] BTRFS info (device dm-9): first mount of filesystem <uuid>
[ 2523.344260] BTRFS info (device dm-9): using crc32c (crc32c-intel)
checksum algorithm
[ 2523.612830] BTRFS error (device dm-9: state C): parent transid
verify failed on logical 9820282388480 mirror 2 wanted 5715946 found
5717327
[ 2523.613372] BTRFS error (device dm-9: state C): parent transid
verify failed on logical 9820282388480 mirror 1 wanted 5715946 found
5717327
[ 2523.639263] BTRFS info (device dm-9: state C): enabling ssd optimizations
[ 2523.639268] BTRFS info (device dm-9: state C): disabling log replay
at mount time
[ 2523.639271] BTRFS info (device dm-9: state C): turning on async discard
[ 2523.639273] BTRFS info (device dm-9: state C): enabling free space tree
[ 2523.639276] BTRFS info (device dm-9: state C): ignoring bad roots
[ 2523.639278] BTRFS info (device dm-9: state C): ignoring data csums
```

The log reports SSD optimization to be enabled because those drives
are bcache backing devices. Bcache was disabled throughout the
operation.

I expect that recovering from backup would take 10 days, so I would
like to avoid that if possible. If there are ways to recompute the
broken metadata for example or other repair operation, I would prefer
doing that.

I asked on #btrfs channel and after helping me succesfully mount the
volume, multicore recommended me to send an email to this mailing
list, so here we are.

What do you think about it? Is there a way to repair the filesytem?

Context: This is a 4 HDD btrfs raid10 volume. Drives are large (16TB
each, Seagate IronWolf Pro).
24 days ago two drives started logging some errors, so I replaced
them. Those drives are bcache backing devices but bcache has been kept
disabled for the whole operation that follows.

I first did a backup of the files in their last state. Then I replaced
the first drive with `btrfs replace`, waited for complete replacement,
then replaced the second drive with `btrfs replace` and waited for
complete replacement again. Once this was done I shut down, removed
the replaced drive, only keeping plugged in the two sane non-replaced
drives and the two sane replacement drives. I then rebooted, mounted
successfully the btrfs volume, and did a scrub. The scrub finished
without error.

It happens that this btrfs volume had been created on September 2023
so I was running Ubuntu Lunar that used Linux 6.2 at the time, and it
lacked the block group tree feature. Mounting was very slow so and it
annoyed me so in February of 2025 I asked on the #btrfs channel if
there was something doable to speed-up things, and it had been told to
me that enabling block group tree would help me. Out of caution, I
didn't do it at the time, waiting for a better moment. Since I just
replaced two drives and did a backup, I thought this was the best
moment to do it, and I did the block group tree conversion, after a
year of patience. It looks like it was the right time to do it but
that I should have not done it.

It also happens that I use btrfs deduplication and compression
extensively, and I do know that in fact once decompressed and
deduplicated the data is larger than the size of the disk storage. So
not only decompressing and copying from borg will be slow (and take
days…), but I'll have to also wait for btrfs to recompress everything
and I'll have to run bees while the copy is going on to deduplicate on
the go to make sure the restoration fits. This will be slow as hell.
That's why I expect the restoration from backup to last 10 days. Since
I'm already in degraded workflow since 24 days, I'm looking for faster
options if they do exist.

So if there is any recovery or repair operation available I want to
try it first. Since I can read the data, can the corrupted metadata be
recomputed?

The system is running Ubuntu 24.04.4 with Linux 6.8.0-110-generic and
btrfs-progs 6.6.3-1.1build2. I can run rescue systems on removable
drives if newer tools are required to repair.

Best regards,

-- 
Thomas “illwieckz” Debesse

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

end of thread, other threads:[~2026-04-27 12:57 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-26 21:23 corruption after block-group-tree conversion, how to recover? (data is readable) Thomas Debesse
2026-04-26 22:18 ` Qu Wenruo
2026-04-27  0:08   ` Ulli Horlacher
2026-04-27  2:24   ` Christoph Anton Mitterer
2026-04-27  2:43   ` Thomas Debesse
2026-04-27  5:26     ` Qu Wenruo
2026-04-27 12:56       ` Thomas Debesse

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