Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 31 Mar 2020 22:28:43 +0300
From:      Artem Kuchin <artem@artem.ru>
To:        freebsd-questions@freebsd.org
Subject:   I see no way to convert LBA to disk position
Message-ID:  <2f107fd2-de31-7dfc-7c3e-abb3597b9f3f@artem.ru>

next in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?2f107fd2-de31-7dfc-7c3e-abb3597b9f3f>