Skip to contentSkip to conversation

btrfs corruption across different storage configurations. Both with free addressable free storage.

DISCUSSION Marcus Lell 1 participant 1 message Nov 23

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

[please CC me, as I'm off list]

I know it's a late report, but I thought, you may know about this one...

I experienced severe Btrfs corruption twice, on Linux 7.1.10 and 7.1.12, using substantially different storage configurations.

Incident 1 — Linux 7.1.10

I was running Btrfs on LUKS/dm-crypt over md RAID5, using four SATA devices with 64 KiB chunks. The incident occurred during or after a RAID5 reshape and enlargement of the encrypted device. After enlarging the crypt layer, I tried mounting the filesystem, but "mount.btrfs" failed.

Subsequent diagnostics revealed metadata errors at offsets beyond Btrfs's reported size:

"total_bytes = 20001389936640"

- Wanted bytenr "20015028908032", found "8567551700635656859"; checksum wanted "0x836ea028", found "0x8db80d65".
- Wanted bytenr "20024023199744", found "12778909791338521120"; checksum wanted "0xfd168e20", found "0x95744024".

These offsets were approximately 13.65 GB and 22.64 GB beyond the reported filesystem size, but within the underlying device's addressable capacity.

I did not touch the underlying filesystem during the enlargement. Just at the end. I was surprised, that an untouched filesystem could go so messed up. I thought, it could be an mdadm grow failure.

I made extensive attempts to diagnose and recover the filesystem. I tried superblock recovery, "btrfs check --repair", "btrfs restore", "btrfs-find-root", mounting with recovery options, and "dmsetup"-based approaches. I also used a device-mapper snapshot to rule out concurrent changes during checking. Despite these efforts, I could not restore a usable filesystem. "btrfs restore" recovered some files but reported checksum errors.

Incident 2 — Linux 7.1.12

I was running Btrfs on an approximately 1 TB root logical volume on LVM, on a single 2 TB NVMe device, without md RAID. The root filesystem became unusable. I recall seeing what appeared to be the same kind of "bytenr" failure, although I no longer have the logs to confirm the exact error. I had not observed unusually large writes before the failure.

I lost the logs of the first attempt, that I saved on the root partition. I was like to be afraid to cope with the responses of you. (I'm shy)

Because the second incident occurred on a substantially different storage configuration, I find it less likely that the problem was specific to the RAID reshape or crypt-layer resizing in the first incident.

I want you to help make the btrfs filesystem more error prone. But I can only point into the direction. I cannot prove that such a write occurred or that both incidents shared the same root cause, but I believe the recurrence and the first incident's specific offsets warrant investigation.

I don't know, how to help further, but I don't dare to trust Linux 7.1.x and successors, with 7.0.x I believe, this is the last stable one. I need to upgrade sooner or later, so please find the root cause of this behavior...

Marcus Lell

Signature · 4 lines
Return to the point of no return._

-- 
Return to the point of no return._