I try to reallocate a bad sector. After reading this Question my understanding is, that the hard-drive tries to reallocate automatically. To trigger the process I tried to write to the sector with dd but nothing changed at all.
$ smartctl -a /dev/sda
...
5 Reallocated_Sector_Ct ... 0
197 Current_Pending_Sector ... 1
...
The bad sector is: 215040
$ dd if=/dev/sda of=/dev/null bs=512 count=1 skip=215040
io-error on reading
Why is the sector not allocated when I write to it?
$ dd if=/dev/zero of=/dev/sda bs=512 count=1 seek=215040
io-error on writing
How can I cause the sector to be rewritten?
cat /sys/block/sda/queue/hw_sector_size– Deltik Sep 29 '15 at 09:13ddfrom what I'm familiar with. I've never seenddoutput "io-error on writing" before, and that string doesn't show up anywhere in the GNU coreutils source code. – Deltik Sep 29 '15 at 09:20--read-sectorgave me? – Sep 06 '16 at 15:17dd if=SECTOR_DUMP of=/dev/YOUR_DISK bs=SECTOR_SIZE seek=ORIGINAL_SECTOR. – Deltik Sep 07 '16 at 16:34xxdto convert them back to binary, and then use a hex editor on them, I get different values. – Sep 08 '16 at 20:03hdparmsector output to binary:sudo hdparm --read-sector SECTOR /dev/YOUR_DISK | grep -Eo '([0-9a-f]{4} ){7}[0-9a-f]{4}' | xxd -r -p– Deltik Sep 08 '16 at 20:11