On Sat, 25 Dec 2010 00:00:45 +0800, Ian Chapman wrote:
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.
Very much true. Bad wording from my part. What I wanted to say that the
bad sector was reported by smartctl but was not detected by badsectors,
when run on the drive.
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.
In my case I never was able to achieve this. I wrote to the sector in
question directly with dd, I did it running badblocks in destructive
(read/write) mode - the values of Current_Pending_Sector and
Offline_Uncorrectable remained still.
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'.
This value for my disk is quite high sinc the drive is 4.5 years old.
It's not a lot for a 3.5" drive but is much enough for a laptop drive
(Dell Latitude d820) I think. Though I'm still disappointed. I expected
it to last more.
You can perform a disk test using smartctl (sounds like you have
already)
You bet. :-)
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.
As I've mentioned in one of my posts, this the only thing I did not do
yet. I'll probably do it on the bad sector reported in
Current_Pending_Sector (the value is 1) since I know it's starting LBA
and I know the block size. But I have no idea what to do with those
reported in Offline_Uncorrectable - the value here is 4.
And it looks like actually Offline_Uncorrectable gives me more of
warning. I looked through my log files and found that it was reported the
first with the lower value a couple of months ago. Than a month later it
increased, while Current_Pending_Sector remained 1. My bad, I've
neglected my log files for a while.