I see no way to convert LBA to disk position

Artem Kuchin artem at artem.ru
Tue Mar 31 19:29:11 UTC 2020


Hello!

I have a strange story. One of the disk in a gmirror array reported  a 
read error.

smartctvl -a showed this:

Sector Sizes:     512 bytes logical, 4096 bytes physical
Error: UNC at LBA = 0x0b3ede08 = 188669448

So, from this it should be very easy to locate the bad block, we have 512 bytes
LBA blocks and we have a block number, so

dd if=/dev/ada2 of=/dev/null bs=512 skip=188669448 count=1

should generate a read error

BUT NO! It is not there! It read okay.

So, i tried many ways and eventually just wrote my own scanner which return me absolute bytes
offset of 2570499919872

convert 512 blocks
2570499919872/512= 5020507656

and
# dd if=/dev/ada2 bs=512 skip=5020507656 count=1 > z
dd: /dev/ada2: Input/output error
0+0 records in
0+0 records out
0 bytes transferred in 19.432749 secs (0 bytes/sec)

Now everything is correct.
So, i have LBA
188669448
and real 512 block offset
5020507656

Then i wrote zeros to the bas sector
dd if=/dev/zero of=/dev/ada2 bs=512 oseek=5020507656 count=8

and pending blocks went away and also
dd if=/dev/ada2 bs=512 skip=5020507656 count=1
now read okay

Question is HOW  5020507656 511 bytes disk blocks offset is related to reported lba  188669448 ?

Artem



More information about the freebsd-questions mailing list