Go4Expert (http://www.go4expert.com/)
-   Engineering Concepts (http://www.go4expert.com/articles/engineering-concepts-tutorials/)
-   -   Recovering Lost Hard Disk Data With ddrescue (http://www.go4expert.com/articles/recovering-lost-hard-disk-data-ddrescue-t27819/)

pradeep 18Feb2012 14:46

Recovering Lost Hard Disk Data With ddrescue
It might happen that your hard disk died on you, or the DVD backup you had does not read correctly. Generally, CD & DVD media retain data correctly for a few years (or more, depending on the quality of the media), after which data loss starts slowly with read errors increasing from the outer tracks of the media towards the innermost track.

ddrescue is a GNU tool for data recovery, it copies data from a file/block devices (cd,dvd,hard disk,flash drive,etc.) to another attempting to recover from read errors, bad sectors, etc. and will provide you with all the data that could be salvaged. Also, ddrescue's algorithm is such that it'll read the 'good' areas of the media first and schedule the 'bad' areas for later which increases the chances of recovering maximum possible data from an already failing media/hard disk.

The beauty of ddrescue is when you use the logfile feature, which can be used to resume to the data recovery in case it was interrupted due to some reason. So, it's always recommended to use the logfile option.

ddrescue allows you to recover specific parts of the media/disk or an entire volume. ddrescue also features auto-merging of backups, i.e. when you have multiple damaged copies of a file/media/disk on which you can run ddrescue one at a time, and you may be able to recover a completely error-free copy.

Getting ddrescue

ddrescue is available on bootable SystemRescueCd, get it from http://www.sysresccd.org/Download

Installing via a package manager varies from distribution to distribution, here are the commands for a few popular distributions:

## Debian
aptitude install gddrescue

## Ubuntu and it's derivaties
sudo apt-get install gddrescue

## CentOS
yum install ddrescue.i386

Installing from source, get the source from http://mirror.yongbok.net/gnu/ddrescue/, untar it, then:


$ ./configure
$ make
## if you may wish to install the binary, i.e. moving it to the system directory
$ make install

ddrescue Usage

I'll show you a few examples which will help you to understand the basic usage - which I think would be enough for most people.

Recover a whole volume into a file,


$ ddrescue /dev/sda1 sdaRecoveredImg sdaRecovery.log
Copy only the error free areas first, then try to recover the error prone areas.


$ ddrescue -n /dev/sda1 sdaRecoveredImg sdaRecovery.log
$ ddrescue --max-retries=3 /dev/sda1 sdaRecoveredImg sdaRecovery.log

Recover a volume to another, but remember the volume being recovered to will be overwritten, so double check you have chosen the correct target volume.


$ ddrescue /dev/sda1 /dev/sdb1 recovery.log
Recover an old CD into a file.


$ ddrescue /dev/cdrom myOldCdImage oldCdRecovery.log
To see all the command line options provided by ddrescue,


man ddrescue



jasbir712 20Feb2012 13:20

Re: Recovering Lost Hard Disk Data With ddrescue
very good command dude...

All times are GMT +5.5. The time now is 17:20.