smartctl reports bad sectors, badblocks does not find any
Ian Chapman
packages at amiga-hardware.com
Fri Dec 24 16:00:45 UTC 2010
On 24/12/10 11:46, Juan R. de Silva wrote:
>
>> I haven't used badblocks, but suspect that the hard disk drive
>> electronics is clever enough to hide damage and relocate bad sectors.
>> The S.M.A.R.T. electronics will still know they are there, though.
>
> OK. This might be the answer to a question I had: why badblocks never
> found them but smartctl did.
AFAIK smartctl doesn't actually "detect" bad sectors on a disk, it just
reports what it sees in the SMART counters. The particular counter is
Current_Pending_Sector I believe. Each time the disk encounters a sector
it can't read, the firmware increments this counter. Only when that bad
sector is written to, does the disk remap the sector and usually
Current_Pending_Sector decreases by 1. I have however seen on occasions,
the counter increase but no bad sector appears to be on the disk. I just
put this down to a temporary glitch, ie the disk at some short point in
time could not read that sector but now it's fine, however the increment
remains. Some drives I believe also increment Reallocated_Sector_Ct
every time a remap is done, but certainly many do it 'silently'.
You can perform a disk test using smartctl (sounds like you have
already) to find the LBA of a bad sector. The output of smartctl -a,
once the test completes, provides test results which look a little like:
Num Test_Description Status Remaining
LifeTime(hours) LBA_of_first_error
# 1 Extended offline Completed without error 00% 13397
-
# 2 Extended offline Completed without error 00% 13293
-
# 3 Selective offline Completed without error 00% 13290
-
# 4 Selective offline Completed without error 00% 13290
-
# 5 Selective offline Completed: read failure 70% 13290
379731309
# 6 Selective offline Completed: read failure 70% 13290
379729059
# 7 Extended offline Completed: read failure 50% 13290
379718855
The last value is the LBA which can used with hdparm --write-sector to
write to that specific sector triggering a remap and usually
decrementing the counter. Be extremely careful when using this command
though as a slight mistake can trash data.
--
Ian Chapman.
More information about the users
mailing list