BTRFS: How to map bad block at partition level into path of file using it?
by remm from LinuxQuestions.org on (#5FRSB)
There are 3 bad sectors on my drive. I know the exact block at the physical drive, and partition levels. I know these are bad, because ddrescue mapped them, and this has been verified by trying to read them via dd. Smart also shows the 3 blocks are bad and marked for relocation on the next write and this is the correct number. For ext4 there is a procedure to take this and figure out what file is using the block. I'm using BTRFS for this partition though. So is there a similar procedure? I also have a few NOCOW files so checksumming is not definitive here. Other ideas? Where I want to get to is to identify the corrupted files and to restore those from backup.
I have tried using "btrfs inspect-internal dump-tree -b ..." which seems like it might do something with a block number, but I don't think I know what kind of block address it wants or what it does, so no success there. I've also tried using "btrfs check --check-data-csum" to see if this would find anything. That said things are good though I did get some console and system log messages showing IO errors and as I said before since I have some NOCOW files it's not definitive in any case. I've avoided doing "btrfs scrub" for now because I don't want to modify the file system... or maybe I should use that...not sure if I can or not without changing the file system. Now I'm actually planning on trying to read every file with "dd" and see if I get an error return on any one of those reads... not sure if that will show anything.
So ideas on what direction to take? Or is there a better forum for this sort of question?
Thanks,
remm


I have tried using "btrfs inspect-internal dump-tree -b ..." which seems like it might do something with a block number, but I don't think I know what kind of block address it wants or what it does, so no success there. I've also tried using "btrfs check --check-data-csum" to see if this would find anything. That said things are good though I did get some console and system log messages showing IO errors and as I said before since I have some NOCOW files it's not definitive in any case. I've avoided doing "btrfs scrub" for now because I don't want to modify the file system... or maybe I should use that...not sure if I can or not without changing the file system. Now I'm actually planning on trying to read every file with "dd" and see if I get an error return on any one of those reads... not sure if that will show anything.
So ideas on what direction to take? Or is there a better forum for this sort of question?
Thanks,
remm