The Bad Block HOWTO hurts my brain
It reads more like a worked example, without enough of the underlying theory. It doesn't help that I have a slightly more complicated situation, in that I have a filesystem on a logical volume that spans 6 physical volumes.
So maybe writing all of this down will help...
I know the disk with the problem: /dev/sdc
I know the LBA of the sector where the rot starts: 754238963
I know that the physical volume is on /dev/sdc1 and that the partition starts at sector 63 (via sfdisk -luS /dev/sdc)
Therefore, within /dev/sdc1, we're talking about block number 754238899 (754238963 - 64)
I know the physical extent size is 4096 Kb (via pvdisplay -c /dev/sdc1 | awk -F: '{ print $8 }'). In LBA block size this becomes 8192 (2 x 4096)
I know the physical extents start 192K (into the partition, presumably) (via pvs -o+pe_start /dev/sdc1)
This is where the Bad block HOWTO starts to quicken the pace a bit on me...
I'm supposed to take the physical partition's bad block number (754238899) and divide it by the size of the physical extent (in LBA block size) (8192). So that'd be 92070.
This is where I think I end up completely departing the HOWTO, because my filesystem spans multiple physical volumes. Here's my general musings...
lvdisplay --maps /dev/data/srv tells me this about /dev/sdc1:
Logical extent 272326 to 391559:
Type linear
Physical volume /dev/sdc1
Physical extents 0 to 119233
So I'm inferring from this, given that I know I want physical extent 92070 of this device, that this corresponds to logical extent 92103 (again, I'm expressing this in LBA block size, so that's (272326 / 8192) + 92070
So now I supposedly know the logical extent (in LBA size) of the bad block. Now what? I think I'm wandering up too many layers, closer to the physical filesystem, but I'll continue wandering around...
So presumably at this point, I just want to convert the logical extent to an actual filesystem block number. Maybe the logical extent number divided by the extent filesystem block size divided by the LBA block size? 92070 / (4096 / 512) = 11508. That feels awfully low though. The dd test suggests this is incorrect.
At this point I'm feeling fairly lost. If someone out there is reading this, and they've done this before, I'd love to hear from you.





