Thomas-Tsai/partclone

btrfs correctable scrub errors after restore

movq opened this issue · 2 comments

movq commented

When restoring a partclone backup of a btrfs partition, I see some scrub errors in the kernel logs. Fortunately, they are correctable, so no data is lost. In one real case I couldn't mount the partition due to btrfs being unable to find the tree root - but mounting with usebackuproot worked. Unfortunately I don't know how to reproduce that case.

I can reproduce the scrub errors on the following setup:

OS: Arch Linux
kernel: 6.6.1-arch1-1
btrfs-progs: v6.6.1
partclone: v0.3.27 (0882b2de94f05d3ad81304872cbd3dff02105239

Steps:

fallocate -l 1G btrfs.img
mkfs.btrfs btrfs.img
sudo partclone.btrfs -c -s btrfs.img -o btrfs.backup
rm btrfs.img
fallocate -l 1G btrfs.img
sudo partclone.btrfs -r -s btrfs.backup -O btrfs.img
sudo mount btrfs.img /mnt
sudo btrfs scrub start /mnt

Then check dmesg and observe errors, e.g.

[  669.241921] BTRFS info (device loop0): scrub: started on devid 1
[  669.242273] BTRFS warning (device loop0): tree block 22036480 mirror 2 has bad bytenr, has 0 want 22036480
[  669.242391] BTRFS error (device loop0): fixed up error at logical 22020096 on dev /dev/loop0 physical 30408704
[  669.242397] BTRFS error (device loop0): fixed up error at logical 22020096 on dev /dev/loop0 physical 30408704
[  669.242399] BTRFS error (device loop0): fixed up error at logical 22020096 on dev /dev/loop0 physical 30408704
[  669.242400] BTRFS error (device loop0): fixed up error at logical 22020096 on dev /dev/loop0 physical 30408704
[  669.242644] BTRFS warning (device loop0): tree block 30539776 mirror 2 has bad bytenr, has 0 want 30539776
[  669.242646] BTRFS warning (device loop0): tree block 30490624 mirror 2 has bad bytenr, has 0 want 30490624
[  669.242648] BTRFS warning (device loop0): tree block 30408704 mirror 2 has bad bytenr, has 0 want 30408704
[  669.242649] BTRFS warning (device loop0): tree block 30523392 mirror 2 has bad bytenr, has 0 want 30523392
[  669.242650] BTRFS warning (device loop0): tree block 30556160 mirror 2 has bad bytenr, has 0 want 30556160
[  669.242652] BTRFS warning (device loop0): tree block 30425088 mirror 2 has bad bytenr, has 0 want 30425088
[  669.242653] BTRFS warning (device loop0): tree block 30572544 mirror 2 has bad bytenr, has 0 want 30572544
[  669.242655] BTRFS warning (device loop0): tree block 30588928 mirror 2 has bad bytenr, has 0 want 30588928
[  669.242737] BTRFS error (device loop0): fixed up error at logical 30474240 on dev /dev/loop0 physical 92536832
[  669.242740] BTRFS error (device loop0): fixed up error at logical 30474240 on dev /dev/loop0 physical 92536832
[  669.242741] BTRFS error (device loop0): fixed up error at logical 30474240 on dev /dev/loop0 physical 92536832
[  669.242742] BTRFS error (device loop0): fixed up error at logical 30474240 on dev /dev/loop0 physical 92536832
[  669.242743] BTRFS error (device loop0): fixed up error at logical 30474240 on dev /dev/loop0 physical 92536832
[  669.242744] BTRFS error (device loop0): fixed up error at logical 30474240 on dev /dev/loop0 physical 92536832
[  669.242795] BTRFS info (device loop0): scrub: finished on devid 1 with status: 0

Hi,

Thanks for this bug report.

Partclone. btrfs v0.3.27 is based on btrfs 6.3.3, so the newer btrfs version would cause some incompatible problems.

I can update it recently.

Hi,

I updated btrfs to v6.6.2, but the scrub error is still here. I also tried to change the btrfs version to v5.14 or 5.6 and got the same error message. Per your test, the btrfs check is fine for any restored image.

We have to spend more time to study the scrub issue.