Drive recovery – `ddrescue` hanging

data-recoveryddrescuehard drive

I'm using ddrescue to recover files from a hard drive. Details:

  • 500GB SATA drive,
  • 2 Partitions (e.g. sdb2, sdb3) – each with about 200 GB of data,
  • connected with SATA adapter to USB,
  • running: sudo ddrescue -d /dev/sdb2 sdb2.img sdb2.logfile --force -R.

The disk is pretty damaged from what I've experienced:

  • Takes a very long time to mount and browse.
  • Becomes unresponsive intermittently.
  • Not much luck copying across files individually one by one.

I've been running ddrescue on each partition and see something strange but which gives me hope.

  • ddrescue just seems to hang at various points in time, i.e. ipos and opos don't move and neither does run time. Current rate stays very high and does not change. What is happening here? Is the drive just becoming completely unresponsive for a while?
  • Very often ddrescue is not making any progress rescuing anything and last sucessful read starts to count up for a very long time – indefinitely really. When this happens I ^C out, powercycle the drive and start ddrescue again. Surprisingly it immediately starts succeeding in rescuing files at very high speeds. Sometimes this lasts and sometimes it's dead in the water after a few seconds.

It looks like this:

rescued:    10970 MB,  errsize:    338 MB,  current rate:   15073 kB/s
   ipos:   191426 MB,   errors:    3806,    average rate:   15612 kB/s
   opos:   191426 MB, run time:    1.65 m,  successful read:       0 s ago

and a while later:

rescued:    11402 MB,  errsize:    600 MB,  current rate:        0 B/s
   ipos:   144382 MB,   errors:    7149,    average rate:    4299 kB/s
   opos:   144382 MB, run time:    7.66 m,  successful read:    2.06 m ago

The fact that the drive reads absolutely fine for a while after it's first plugged in makes me think there is something other than bad sectors at play here. Could I for example write a bash script that power cycles and restarts ddrescue often? Will this kill the drive? For info, I took some practices into play from this post about ddrescue.

Best Answer

  • SATA to USB adapters vary. Some of them forget about the disk upon encountering I/O errors while others return I/O errors and continue. There is a wide range of behaviors depending on which adapter you're using.

    I think that yours is blocking all I/O until it is power cycled.

    You probably can't physically disconnect and reconnect the adapter from the command line to reset its power status, but you can try to reset the USB device or USB ports.

    If that doesn't work, I recommend plugging in the hard drive directly by SATA and then running ddrescue while the hard drive is plugged in by SATA. That way, you would bypass the USB adapter, which seems to get stuck upon each error.

  • Related Question