[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Trimming away bad sectors...



Still chasing that darned file transfer error. I may have tracked it
down to one or more bad sectors on my laptop's hard drive. To be sure, I
could use a bit of review on my diagnostics and a check of my math at
the end of this message.

By the numbers...

(1) # fdisk -lu /dev/hda
    
    Disk /dev/hda: 48.0 GB, 48004669440 bytes
    16 heads, 63 sectors/track, 93015 cylinders, total 93759120 sectors
    Units = sectors of 1 * 512 = 512 bytes
    
    Device Boot      Start         End      Blocks   Id  System
    /dev/hda1   *          63      211679      105808+  83  Linux
    /dev/hda2          211680    20699279    10243800   83  Linux
    /dev/hda3        20699280    22785839     1043280   82  Linux swap
    /dev/hda4        22785840    93759119    35486640    f  W95 Ext'd (LBA)
    /dev/hda5        22785903    93759119    35486608+  83  Linux

(2) # dd if=/dev/hda5 of=/dev/null
    dd: reading `/dev/hda5': Input/output error
    4825684+0 records in
    4825684+0 records out

(3) # cat /var/log/messages | grep LBA
    Nov 15 18:15:01 lioness kernel: hda: dma_intr: error=0x40
    { UncorrectableError }, LBAsect=42088723, sector=42088559
    ...
    Nov 15 18:24:30 lioness kernel: hda: dma_intr: error=0x40
    { UncorrectableError }, LBAsect=42088723, sector=42088723

(4) # smartctl -t /dev/hda
    ...
    Error 398 occurred at disk power-on lifetime: 9588 hours (399 days + 12 hours)
    When the command that caused the error occurred, the device was active or idle .
    
    After command completion occurred, registers were:
    ER ST SC SN CL CH DH
    -- -- -- -- -- -- --
    40 51 5c 13 39 82 e2  Error: UNC 92 sectors at LBA = 0x02823913 = 42088723
    
    Commands leading to the command that caused the error were:
    CR FR SC SN CL CH DH DC   Powered_Up_Time  Command/Feature_Name
    -- -- -- -- -- -- -- --  ----------------  --------------------
    c8 00 60 0f 39 82 e2 00   1d+19:23:07.300  READ DMA
    c8 00 61 0e 39 82 e2 00   1d+19:23:03.900  READ DMA
    c8 00 62 0d 39 82 e2 00   1d+19:23:00.500  READ DMA
    c8 00 63 0c 39 82 e2 00   1d+19:22:57.200  READ DMA
    c8 00 64 0b 39 82 e2 00   1d+19:22:53.800  READ DMA
    ...

OK. Armed with this information I _think_ the following will copy all
data from the beginning of /dev/hda5 up to the bad sector(s), and then
from after the bad sector(s) to the end of /dev/hda5:

listener:
    # nc -l -p 30000 > hda5_before.img
sender:
    # dd if=/dev/hda5 count=1930302819 bs=2048 | nc 192.168.1.2 30000 -w 3
                            ^^^^^^^^^^ = 42088722-22785903
listener:
    # nc -l -p 30000 > hda5_after.img
sender:
    # dd if=/dev/hda5 skip=1930302820 bs=2048 | nc 192.168.1.2 30000 -w 3

One of these command lines may include the bad sectors. Can younger,
more experienced eyes verify them for me?

-- Doc 
Robert G. (Doc) Savage, BSE(EE), CISSP, RHCE | Fairview Heights, IL
Fedora Core 3 kernel 2.6.9-1.667 on a P-III/M IBM Thinkpad A22p
"Perfection is the enemy of good enough."
                         -- Admiral of the Fleet Sergei G. Gorshkov


-
To unsubscribe, send email to majordomo@silug.org with
"unsubscribe silug-discuss" in the body.