amendment for "Bad block HOWTO" page

Peter van Hoof <[email protected]>
Newsgroups gmane.linux.utilities.smartmontools
Organization Royal Observatory of Belgium
Message-ID <[email protected]>
Hi,

I found that the information given on the "Bad block HOWTO" page for 
forcing a bad sector to be replaced doesn't work on a disk with a 4 kiB 
physical sector size. At least that is the case on my Seagate Barracuda 
7200.14 3 TB drive. This is what I found:

Running a short self-test on this drive revealed a bad sector:

# 1  Short offline       Completed: read failure       70%     10174 
      4130265680

I double-checked this with dd:

# dd if=/dev/sde of=/dev/null bs=512 skip=4130265680 count=1
dd: error reading ‘/dev/sde’: Input/output error
0+0 records in
0+0 records out
0 bytes (0 B) copied, 6.80211 s, 0.0 kB/s

So indeed, this sector is bad and I want to replace it. This is what I 
did, following the description on your (otherwise excellent) HOWTO page:

# dd if=/dev/zero of=/dev/sde bs=512 seek=4130265680 count=1
dd: error writing ‘/dev/sde’: Input/output error
1+0 records in
0+0 records out
0 bytes (0 B) copied, 22.6075 s, 0.0 kB/s

The operation failed! Doing another read operation as shown above 
confirmed that the bad sector was indeed not replaced. So on a hunch I 
decided to try using a 4 kiB buffer size. This means that the value for 
the skip parameter needs to be adjusted. There are eight logical 
512-byte sectors in one 4096-byte physical sector, so the new skip value 
should be 4130265680 / 8 = 516283210. Using this, the new command becomes:

# dd if=/dev/zero of=/dev/sde bs=4096 seek=516283210  count=1
1+0 records in
1+0 records out
4096 bytes (4.1 kB) copied, 0.000359402 s, 11.4 MB/s

And now the operation succeeded! Double-checking confirmed that the bad 
sector was indeed replaced now:

# dd if=/dev/sde of=/dev/null bs=512 skip=4130265680 count=1
1+0 records in
1+0 records out
512 bytes (512 B) copied, 0.000310025 s, 1.7 MB/s

So it looks like replacing a bad sector only works if you overwrite the 
entire physical sector in one single write operation. Overwriting only 
part of the physical sector has no effect.


Peter van Hoof.

------------------------------------------------------------------------------
Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk
_______________________________________________
Smartmontools-support mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/smartmontools-support
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.