kdave / btrfs-progs

Development of userspace BTRFS tools
GNU General Public License v2.0
563 stars 245 forks source link

Need more options to address uncorrectable `btrfs scrub` error. #867

Open tribbloid opened 3 months ago

tribbloid commented 3 months ago

here is an example the scrub output:

$ sudo btrfs scrub status /dev/nvme0n1p7
UUID:             a5c81116-78a5-4edb-b57c-b08e90e1391b
Scrub started:    Fri Aug  9 16:58:37 2024
Status:           finished
Duration:         0:02:50
Total to scrub:   407.09GiB
Rate:             2.39GiB/s
Error summary:    csum=11
  Corrected:      0
  Uncorrectable:  11
  Unverified:     0

there are 11 uncorrectable csum error, during the lifespan of the partition these errors will gradually accumulate and caused affected file blocks to be without csum.

The scrub command (or another command) should give user the following 2 options:

this feature should be used with care, but will restore csum for affected files

adam900710 commented 3 months ago

Check the dmesg which contains the filename.

And if you really want to fix the corruption, you should go profiles with duplication.

tribbloid commented 3 months ago

I thought profiles with duplication is always enabled after kernel 5.15? https://forum.manjaro.org/t/howto-convert-btrfs-profile-of-metadata-single-to-dup-duplicate-of-metadata-is-more-safe-than-single/115534

even with that feature there is a possibility of metadata corruption (e.g. if CoW is disabled, or write history is being dropped)

adam900710 commented 3 months ago

Go duplication profiles for DATA!!

If it's metadata corruption your fs is already doomed, but that's not the case.