I see no way to convert LBA to disk position
Artem Kuchin
artem at artem.ru
Wed Apr 1 09:54:39 UTC 2020
I am having troubles with my mail system - i do not see about half of
all messages in the freebsd listrs
and they are not in spam.
So, i will answer to myself and others
1. About writing zeroes to reset pending sectors:
My mistakes. It is not related to smart specs. It is just how people do
it. Probably because it is easy to write
zeros and read them back to check. /dev/urandom is not good for that.
But i think any write will trigger remapping or repair.
2. About LBA->sector offset question
I found this on man page for smartctl:
Because of the limitations of the SMART error log,
if the LBA is greater than 0xfffffff, then either no
error log entry will be made, or the error log entry will have
an incorrect LBA. This may happen for drives with a capacity
greater than 128 GiB or 137 GB.
Now, lets see in binary what i have in smart and what i have in reality
in smart
1011001111101101111000001000
in reality
100101011001111101101111000001000
So, as you see, the real LBA address is
10010 concat 1011 00111110 11011110 00001000
So, there is just not enough bits to store and show full LBA address.
The smart log conrain onky 28 bits if LBA - it is ATA-1 spec of 1986!!!
The disk itself is ATA-8 specs
and has 48 bit LBA.
This specs (ATA-8):
http://www.t13.org/documents/uploadeddocuments/docs2008/d1699r6a-ata8-acs.pdf
in A.15.1 Overview says "The Summary SMART Error log supports 28-bit
addressing only."
and The value of the Summary SMART Error log version byte shall be 01h
smartctl shows error log version 1 for my disk, it is summary error log
with only 28bit LBA
Next version of log: comprehensive error log (02h) - and it is also only
28 bit LBA.
The next version of log if EXTENDED comprehensive error log (03h) - and
only this error log has 48 bit LBA.
However, my disk DOES include EC error log! Then i looked at the
smartctl man page to see why i don't
see it and i found my mistake.
-a option does not include -xerror
but -x option - does
So,smartctl -x /dev/ada2 shows
SMART Extended Comprehensive Error Log Version: 1 (1 sectors)
Error: WP at LBA = 0x12b3ede08 = 5020507656
Whis is exactly what i found myself (512 block) - 5020507656
From there it is easy to check if it is used by a file:
# gpart show
=> 34 5860533101 ada2 GPT (2.7T)
34 6 - free - (3.0K)
40 128 1 freebsd-boot (64K)
168 8388608 2 freebsd-swap (4.0G)
8388776 5852144352 3 freebsd-ufs (2.7T)
5860533128 7 - free - (3.5K)
5020507656- 8388776 = 5012118880
This is our 512K block relative to filsystrem start (ada2p3 in my case)
then
fsdb /dev/ada2p3
findblk 5012118880
if result is empty then it is not allocated
since the real sector is 4096 then we need to write zeros (or something)
to 8 secots starting from 5012118880
# enable writing to raw devices
sysctl -w kern.geom.debugflags=16
# write to raw device offset !!! NOT TO FS OFFSET
dd if=/dev/zero of=/dev/ada2 oseek=5020507656 count=8
# disable write to raw device
sysctl -w kern.geom.debugflags=0
Voila! no pendig sectors and, in my case, no relocated too. Probably
power glitch while write.
Artem
More information about the freebsd-questions
mailing list