Linux: Disk recovery with ddrescue

Hi

‘ddrescue –direct’ will open the input with the O_DIRECT option for uncached reads. ‘raw devices’ are not needed on newer kernels. For older kernels see below.

First you copy as much data as possible, without retrying or splitting sectors:


ddrescue -f -n /dev/hda1 imagefile logfile

Now let it retry previous errors 3 times, using uncached reads:

ddrescue -d -f -r3 /dev/hda1 imagefile logfile

If that fails you can try again but retrimmed, so it tries to reread full sectors:

ddrescue --direct --retrim --max-retries=3 /dev/hda1 imagefile logfile

Example 3: Rescue an entire hard disk /dev/sda to another disk /dev/sdb

copy the error free areas first

ddrescue -n /dev/sda /dev/sdb rescue.log

attempt to recover any bad sectors

ddrescue -r 1 /dev/sda /dev/sdb rescue.log

Michael

Leave a Reply