1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Recovering Lost Hard Disk Data With ddrescue

Discussion in 'Engineering Concepts' started by pradeep, Feb 18, 2012.

  1. pradeep

    pradeep Team Leader

    Apr 4, 2005
    Likes Received:
    Trophy Points:
    Kolkata, India
    Home Page:
    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


  2. jasbir712

    jasbir712 New Member

    Jan 31, 2012
    Likes Received:
    Trophy Points:
    very good command dude...

Share This Page