BTRFS-Errors - How to fix?

After the hardware crash of my Proxmox master node and rebuild with Odroid H3+ I have BTRFS-Errors within the NS8-VM.

~# btrfs device stats /dev/sda1
[/dev/sda1].write_io_errs    0
[/dev/sda1].read_io_errs     0
[/dev/sda1].flush_io_errs    0
[/dev/sda1].corruption_errs  364
[/dev/sda1].generation_errs  0

These errors are still existing also after scrubbing

~# btrfs scrub start -Bd /dev/sda1

Scrub device /dev/sda1 (id 1) done
Scrub started:    Sat Nov 30 18:00:07 2024
Status:           finished
Duration:         0:00:33
Total to scrub:   24.07GiB
Rate:             633.60MiB/s
Error summary:    no errors found

This Error summary: no errors found is missleding!

One additional device stat show the same errors.

Can someone please help me to fix this problem?

According to the btrfs documentation:

The device stats keep persistent record of several error classes related to doing IO. The current values are printed at mount time and updated during filesystem lifetime or from a scrub run.

corruption_errs
A block checksum mismatched or a corrupted metadata header was found.

-z|--reset
Print the stats and reset the values to zero afterwards.

If the reported stats are no longer needed because the errors are fixed (maybe you can run btrfs check or whatever is needed to recheck blocks and metadata headers):

btrfs device stats --reset /dev/sda1
3 Likes

I think it’s alright as the btrfs scrub shows no errors.
The btrfs stats command also presents historical errors that may be fixed already, see also https://www.reddit.com/r/btrfs/comments/zqmbnw/comment/j0yw1og/

You could try to reset the stats and check if the error occurs again. BTW, please also check the SMART status of the disk to exclude hardware errors.

btrfs device stats --reset /dev/sda1

See also Btrfs: How do you clear the cumulative error counts that show up in 'btrfs device stats'? - Unix & Linux Stack Exchange

EDIT:

Haha I was too late

2 Likes