hdparm – 读取扇区和dd与“当前待处理扇区”之间的差异

这最初是如何使用hdparm来解决待定扇区的“答案” ?

我一直在为相同的“当前待定部门”获得SMART通知几天。 dd解决scheme并没有解决任何问题(他们似乎是零数据,重写它,但没有影响智能状态)。 被警告,我不是这方面的大师 ,只是来自论坛的货运指令。

在不改变情况下使用的dd命令:

 # 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 

清除Current_Pending_Sector计数的hdparm命令:

 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 

我没有得到任何这些命令的读/写错误,所以没有错误可能只是驱动器能够有效地掩盖起来。

而且,再次运行dd将会恢复数据,但即使如此, hdparm --read-sector也会显示零。 我把这个解释为hdparm在较低级别与驱动器通话并强制等待写入,但是dd只是看到了驱动器重新映射的结果……这是怎么回事?

更新 一个随机的post,注意hdparm和dd输出之间的差异 。 hdparm-9.42改变了“强制扇区转储(读扇区,识别,..)使用le16输出格式”。