This was originally an "answer" to How to use hdparm to fix a pending sector?
I'd been getting SMART notifications for the same "Current Pending Sector" for days.
The dd
solutions around weren't resolving anything (they'd appear to zero data and re-write it but didn't effect the smart status). Be warned, I am no guru on this,
just cargo-culting commands from forums.
The dd
commands I used without changing the situation:
# read to file (all cmds ran w/o errors)
dd if=/dev/sdb of=bl.$BLOCK bs=1024 count=1 iflag=direct skip=$BLOCK
# zero out
dd if=/dev/zero of=/dev/sdb bs=1024 count=1 conv=noerror,sync seek=$BLOCK
# read the zeroes back
dd if=/dev/sdb of=/dev/stdout bs=1024 count=1 iflag=direct skip=$BLOCK | xxd
# write real data back out
dd if=bl.$BLOCK of=/dev/sdb bs=1024 count=1 iflag=direct seek=$BLOCK
# verify they match
dd if=/dev/sdb of=/dev/stdout bs=1024 count=1 iflag=direct skip=$BLOCK | xxd \
| diff - <(xxd bl.$BLOCK)
# still have the Current_Pending_Sector error
smartctl -A /dev/sdb | grep Pend
197 Current_Pending_Sector 0x0032 200 200 000 .. 1
The hdparm commands that cleared the Current_Pending_Sector count:
hdparm --read-sector $BLOCK /dev/sdb # data (didn't seem to match dd out)
# this was very slow on the first block
hdparm --write-sector $BLOCK /dev/sdb
hdparm --read-sector $BLOCK /dev/sdb # zeros
smartctl -A /dev/sdb | grep Pend
197 Current_Pending_Sector 0x0032 200 200 000 .. 0
I didn't get any read/write errors with any these command, so the absence of errors may just be the drive is able to effectively cover them up somehow.
Also, running the dd
ones again would appear to restore the data,
but even then the hdparm --read-sector
would show zeros.
I'm interpreting this as the hdparm talking to the drive at a lower level
and forcing the Pending writes, but dd just sees the drives remapped results...
is that what could be going on?
Update A random post noting the difference between hdparm and dd output. hdparm-9.42 has a change to "force sector dumps (read-sector, identify, ..) to use le16 output format".