0

I've purchased two 2TB drives. One has been formatted with an HFS+ (non-journaled) filesystem, and ~800GB of files written with rsync. I'm attempting to create a backup on the second with a basic dd block copy, but my operation repeatedly errors out reading the drive:

root@deb-server:/home/adm_user# dd if=/dev/sdb bs=32M | pv -s 2000G | dd of=/dev/sdc bs=32M
dd: error reading ‘/dev/sdb’: Input/output error              ]  0% ETA 28:24:40
75+1 records in
75+1 records out
2519728128 bytes (2.5 GB) copied2.35GiB 0:02:00 [19.9MiB/s] [>                                ]  0%             
, 120.663 s, 20.9 MB/s
0+36998 records in
0+36998 records out
2519728128 bytes (2.5 GB) copied, 125.599 s, 20.1 MB/s

root@deb-server:/home/adm_user# dd if=/dev/sdb bs=1M | pv -s 2000G | dd of=/dev/sdc bs=1M
dd: error reading ‘/dev/sdb’: Input/output error              ]  0% ETA 26:07:44
10333+1 records in
10333+1 records out
10.1GiB 0:07:57 [21.6MiB/s] [>                                ]  0%             
10835591168 bytes (11 GB) copied, 477.965 s, 22.7 MB/s
0+152209 records in
0+152209 records out
10835591168 bytes (11 GB) copied, 478.852 s, 22.6 MB/s

root@deb-server:/home/adm_user# dd if=/dev/sdb bs=1M | pv -s 2000G | dd of=/dev/sdc bs=1M
dd: error reading ‘/dev/sdb’: Input/output error              ]  0% ETA 25:55:35
13796+1 records in136KiB/s] [>                                ]  0% ETA 25:58:01
13796+1 records out
14466285568 bytes (14 GB) copied13.5GiB 0:10:34 [21.7MiB/s] [>                                ]  0%             
, 634.609 s, 22.8 MB/s
0+202579 records in
0+202579 records out
14466285568 bytes (14 GB) copied, 635.957 s, 22.7 MB/s

root@deb-server:/home/adm_user# dd if=/dev/sdb of=/dev/sdc
dd: error reading ‘/dev/sdb’: Input/output error
186677728+0 records in
186677728+0 records out
95578996736 bytes (96 GB) copied, 13782 s, 6.9 MB/s

root@deb-server:/home/adm_user# dd if=/dev/sdb of=/dev/sdc
dd: error reading ‘/dev/sdb’: Input/output error
167896800+0 records in
167896800+0 records out
85963161600 bytes (86 GB) copied, 12391.2 s, 6.9 MB/s

The errors never occur at the exact same spot, which indicates to me it's not hitting a bad sector on the disk. As you can see I've tried with more modest block sizes, and without pv, which seems to make more progress but still eventually errors out. I've snipped several more attempts, which all encounter the same error at different points.

I've read about a dozen forum threads and Stack Exchange posts on similar issues, and the conclusion always seems to be "dd I/O errors == disk failure". Others describing this problem are generally trying to recover old/known bad disks however, while hardware failure seems unlikely in this case: these are two brand new disks (a reputed model from HGST) and USB enclosures. What is quite likely are corrupt files on the disk: they were consolidated from about a dozen other disks of varying age and condition. From my understanding, filesystem or file errors are irrelevant to a block copy (also, no partitions were cloned to the disk).

I'm aware I can instruct dd to continue the copy with errors, and my next step is to do a (presumably much slower) filesystem-level backup with rsync, but first I'd like to get more certainty on whether this disk is good or not. I've considered a few other explanations, and am looking for guidance on how to diagnose this error. Other possibilities:

  • Constrained resources: the Debian system has ~6.5GB of free RAM and 2.4 GB free disk space which seems adequate to me.
  • USB bandwidth: this system has only USB 2.0 ports and both drives are connected through these (powered externally). Could dd simply error out because it's trying to read faster than the link allows?
  • I also noticed some missing details in hdparm such as cache size. Is it possible to be missing some driver support for a disk?

    /dev/sdb:
    
    ATA device, with non-removable media
        Model Number:       Hitachi HUA723020ALA641                 
        Serial Number:      YGHJ32SD            
        Firmware Revision:  MK7OA840
        Transport:          Serial, ATA8-AST, SATA 1.0a, SATA II Extensions, SATA Rev 2.5, SATA Rev 2.6; Revision: ATA8-AST T13 Project D1697 Revision 0b
    Standards:
        Used: unknown (minor revision code 0x0029)
        Supported: 8 7 6 5 
        Likely used: 8
    Configuration:
        Logical             max     current
        cylinders   16383   16383
        heads               16      16
        sectors/track       63      63
        --
        CHS current addressable sectors:   16514064
        LBA    user addressable sectors:  268435455
        LBA48  user addressable sectors: 3907029168
        Logical  Sector size:                   512 bytes
        Physical Sector size:                   512 bytes
        device size with M = 1024*1024:     1907729 MBytes
        device size with M = 1000*1000:     2000398 MBytes (2000 GB)
        cache/buffer size  = unknown
        Form Factor: 3.5 inch
        Nominal Media Rotation Rate: 7200
        [...]
    
  • Edit: per recommendation I've checked /var/log/messages. It contains several sequences like below. Does this indicate the USB controller is crashing/failing and dropping the disk during read?

    Dec 11 10:15:26 deb-server kernel: [409707.840187] usb 2-1.8: USB disconnect, device number 17
    Dec 11 10:15:26 deb-server kernel: [409707.847408] sd 19:0:0:0: [sdb] Unhandled error code
    Dec 11 10:15:26 deb-server kernel: [409707.847412] sd 19:0:0:0: [sdb]  
    Dec 11 10:15:26 deb-server kernel: [409707.847413] Result: hostbyte=DID_NO_CONNECT driverbyte=DRIVER_OK
    Dec 11 10:15:26 deb-server kernel: [409707.847414] sd 19:0:0:0: [sdb] CDB: 
    Dec 11 10:15:26 deb-server kernel: [409707.847415] Read(10): 28 00 00 5e 93 00 00 00 f0 00
    Dec 11 10:15:26 deb-server kernel: [409707.847423] quiet_error: 22 callbacks suppressed
    Dec 11 10:15:26 deb-server kernel: [409707.847473] sd 19:0:0:0: [sdb] Unhandled error code
    Dec 11 10:15:26 deb-server kernel: [409707.847474] sd 19:0:0:0: [sdb]  
    Dec 11 10:15:26 deb-server kernel: [409707.847475] Result: hostbyte=DID_NO_CONNECT driverbyte=DRIVER_OK
    Dec 11 10:15:26 deb-server kernel: [409707.847476] sd 19:0:0:0: [sdb] CDB: 
    Dec 11 10:15:26 deb-server kernel: [409707.847477] Read(10): 28 00 00 5e 93 f0 00 00 10 00
    Dec 11 10:15:27 deb-server kernel: [409708.303411] usb 2-1.8: new high-speed USB device number 18 using ehci-pci
    Dec 11 10:15:27 deb-server kernel: [409708.396916] usb 2-1.8: New USB device found, idVendor=2537, idProduct=1066
    Dec 11 10:15:27 deb-server kernel: [409708.396921] usb 2-1.8: New USB device strings: Mfr=1, Product=2, SerialNumber=3
    Dec 11 10:15:27 deb-server kernel: [409708.396924] usb 2-1.8: Product: NS1066
    Dec 11 10:15:27 deb-server kernel: [409708.396926] usb 2-1.8: Manufacturer: Norelsys
    Dec 11 10:15:27 deb-server kernel: [409708.396928] usb 2-1.8: SerialNumber: 0123456789ABCDE
    Dec 11 10:15:27 deb-server kernel: [409708.397214] usb-storage 2-1.8:1.0: USB Mass Storage device detected
    Dec 11 10:15:27 deb-server kernel: [409708.397573] scsi20 : usb-storage 2-1.8:1.0
    Dec 11 10:15:27 deb-server kernel: [409708.984090]  sdc: sdc1
    Dec 11 10:15:28 deb-server kernel: [409709.916622] scsi 20:0:0:0: Direct-Access     ATA      Hitachi HUA72302 A840 PQ: 0 ANSI: 6
    Dec 11 10:15:28 deb-server kernel: [409709.916953] sd 20:0:0:0: Attached scsi generic sg2 type 0
    Dec 11 10:15:28 deb-server kernel: [409709.917560] sd 20:0:0:0: [sdb] 3907029168 512-byte logical blocks: (2.00 TB/1.81 TiB)
    Dec 11 10:15:28 deb-server kernel: [409709.918568] sd 20:0:0:0: [sdb] Write Protect is off
    Dec 11 10:15:28 deb-server kernel: [409709.919565] sd 20:0:0:0: [sdb] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
    Dec 11 10:15:28 deb-server kernel: [409709.927455]  sdb: sdb1
    Dec 11 10:15:28 deb-server kernel: [409709.930559] sd 20:0:0:0: [sdb] Attached SCSI disk
    
  • Please take a look in /var/log/messages for any useful error messages. Can also run tail -f /var/log/messages while you run the dd. – Dan Armstrong Dec 13 '16 at 6:44
  • @DanArmstrong thank you for the tip, I've added what I found there. Currently I'm running another attempt, after switching the source and target disk enclosures. Curiously it's proceeded further than any of the others--will update tomorrow when I have the results. – ghostly_s Dec 13 '16 at 7:35
1

It depends on what do you mean for hardware failure, but yes, it is some kind of hardware failure.

It could be a transient one (power supply, overheating, or just a communication error), or a real hardware problem on power supply, on cables, on harddisk (or on some controller chip, but it is more seldom).

Stop using dd and but uses rescueddm not to ruin further the hardisk, until you rule out problem on disk.

  • How will using rescuedd prevent "ruining further" the hardisk, or help in ruling out a disk problem? – ghostly_s Dec 14 '16 at 13:55
  • ghostly_s: dd will try to read again broken sectors as he find them, but this could damage further the disk. rescuedd is created to preserve disk as much as possible, so when there is a problem, it will go away from that zone, and it will copy the rest, then it will return backward (on remaining sectors), etc. So it tries to recover as much as possible, and retry broken sectors are least as possible (only at the end). – Giacomo Catenazzi Dec 14 '16 at 14:09
  • Nothing about what I'm seeing here indicates bad sectors on the disk. I'm not following how this advice is relevant to the situation described. – ghostly_s Dec 17 '16 at 23:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.