Changes between Version 22 and Version 23 of BadBlockHowto


Ignore:
Timestamp:
05/24/2018 05:19:44 PM (7 months ago)
Author:
jinn
Comment:

Added reference to use hdparm when dd is unable to force the sector reallocation.

Legend:

Unmodified
Added
Removed
Modified
  • BadBlockHowto

    v22 v23  
    165165root]# dd if=/dev/zero of=/dev/hda3 bs=4096 count=1 seek=2269012
    166166root]# sync
     167}}}
     168
     169On some occasions using `dd` may not result in the sector being reallocated, with an error along the following lines:
     170
     171{{{
     172May 24 14:19:30 ht-xm-2 kernel: ata1.00: exception Emask 0x0 SAct 0x8000000 SErr 0x0 action 0x0
     173May 24 14:19:30 ht-xm-2 kernel: ata1.00: irq_stat 0x40000008                                 
     174May 24 14:19:30 ht-xm-2 kernel: ata1.00: failed command: READ FPDMA QUEUED                   
     175May 24 14:19:30 ht-xm-2 kernel: ata1.00: cmd 60/08:d8:08:16:00/00:00:01:00:00/40 tag 27 ncq dma 4096 in
     176     res 41/40:08:0a:16:00/00:00:01:00:00/00 Emask 0x409 (media error) <F>                                                                                                           
     177May 24 14:19:30 ht-xm-2 kernel: ata1.00: status: { DRDY ERR }                                 
     178May 24 14:19:30 ht-xm-2 kernel: ata1.00: error: { UNC }                                       
     179May 24 14:19:30 ht-xm-2 kernel: ata1.00: configured for UDMA/133                             
     180May 24 14:19:30 ht-xm-2 kernel: sd 0:0:0:0: [sda] tag#27 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
     181May 24 14:19:30 ht-xm-2 kernel: sd 0:0:0:0: [sda] tag#27 Sense Key : Medium Error [current]   
     182May 24 14:19:30 ht-xm-2 kernel: sd 0:0:0:0: [sda] tag#27 Add. Sense: Unrecovered read error - auto reallocate failed
     183May 24 14:19:30 ht-xm-2 kernel: sd 0:0:0:0: [sda] tag#27 CDB: Read(16) 88 00 00 00 00 00 01 00 16 08 00 00 00 08 00 00
     184May 24 14:19:30 ht-xm-2 kernel: blk_update_request: I/O error, dev sda, sector 16782858       
     185May 24 14:19:30 ht-xm-2 kernel: Buffer I/O error on dev sda, logical block 2097857, async page read
     186May 24 14:19:30 ht-xm-2 kernel: ata1: EH complete
     187}}}
     188
     189In this case you may have better success using the `hdparm` tool.  First confirm the read error on the sector, which would look like this for the above error:
     190
     191{{{
     192# hdparm --read-sector 16782858 /dev/sda
     193}}}
     194
     195And when you've confirmed the sector is indeed unreadable, use `hdparm` to write to that sector:
     196
     197{{{
     198# hdparm --write-sector 16782858 /dev/sda
    167199}}}
    168200
     
    340372[root]# dd if=/dev/zero of=/dev/hda bs=512 count=17 seek=35495735
    341373}}}
     374
     375If using `dd` doesn't result in a reallocation, you may have better luck using `hdparm` as documented in the first example on this page.
    342376
    343377At this point we now have: