msgbartop
A chronological documentation test project, nothing serious, really!
msgbarbottom

23 May 2012 Rescue a damaged disk using GNU ddrescue

Posted by

GNU ddrescue (gddrescue) is a linux data recovery tool. It copies data from one file or block device (harddisc, cdrom, etc) to another, trying hard to rescue data in case of read errors.
It can also be used as a forensic cloning tool.

Installing gddrescue in Ubuntu linux

# aptitude install gddrescue

The command to use for gddrescue is ddrescue, don’t ask me why it is not called gddrescue.

First you copy as much data as possible, without retrying or splitting sectors.
This example rescues data from one disk to another

# ddrescue --force /dev/sda /dev/sdb logfile.ddrescue

Warning! This overwrites content on /dev/sdb

When you use a log file you can stop ddrescue any time by pressing Ctrl+ C to interrupt the process.

You restart it again with the same parameters and ddrescue will resume from where it was before it was interrupted. This is good to know since this can be a time consuming process.

Now let it retry previous errors reported in the logfile 3 times, using uncached reads

# ddrescue --force --direct --max-retries=3 /dev/sda /dev/sdb logfile.ddrescue
Press Ctrl-C to interrupt
Initial status (read from logfile)
rescued:        2 TB,  errsize:   69632 B,  errors:     136
Current status
rescued:        2 TB,  errsize:   49152 B,  current rate:      256 B/s
   ipos:   916972 MB,   errors:      96,    average rate:      359 B/s
   opos:   916972 MB,     time from last successful read:       0 s
Retrying bad sectors... Retry 1

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

# ddrescue --force --direct --retrim --max-retries=3 /dev/sda /dev/sdb logfile.ddrescue

You should now have rescued some data that you can continue your rescue work with.
There may be another post about that later.

Rescue a bad CDROM using ddrescue

# ddrescue -n -b2048 /dev/cdrom cdimage.img logfile.ddrescue
# ddrescue -d -b2048 /dev/cdrom cdimage.img logfile.ddrescue

The cdimage.img file can then be mounted as a loop file or written to a CDROM.

Tags: , , ,

Comments are closed.