Home Linux
 Bash Syntax

ddrescue

Data recovery tool, save data from a crashed partition.

Syntax
      ddrescue [options] infile outfile [logfile]

Options:
-b=bytes Hardware block size of input device [512] --block-size=bytes

-B Show binary multipliers in numbers [default SI] --binary-prefixes

-c=blocks Hardware blocks to copy at a time [128] --cluster-size=blocks

-C Do not read new data beyond logfile limits --complete-only

-d Use direct disc access for input file --direct

-e=n Maximum number of error areas allowed --max-errors=n

-i=pos Starting position in input file [0] --input-position=pos

-n Do not try to split error areas --no-split

-o=pos Starting position in output file [ipos] --output-position=pos

-q Quiet operation --quiet

-r=n Exit after given retries (-1=infinity) [0] --max-retries=n

-s=bytes Maximum size of data to be copied --max-size=bytes

-t Truncate output file --truncate

-v Verbose operation --verbose
-V Output version information and exit --version

Numbers may be followed by a multiplier: b = blocks, k = kB = 10^3 = 1000, Ki = KiB = 2^10 = 1024, M = 10^6, Mi = 2^20, G = 10^9, Gi = 2^30, etc...

Installation

Debian / Ubuntu Linux:
# apt-get install ddrescue

RedHat /Fedora /CentOS Linux:
# yum -y install ddrescue

ddrescue written by Antonio Diaz Diaz, download from the GNU web site.
Installs as /usr/bin/ddrescue

Example:

To copy /dev/sda (damaged \device\harddisk0) to another drive /dev/sdb (empty \device\harddisk1)

# ddrescue /dev/sda /dev/sdb

To recover the partition data run fsck, for example if /home (user data) is on /dev/sda2, run fsck on partition /dev/sdb2:
# fsck /dev/sdb2

This avoids touching the damaged /dev/sda, if the procedure fails you can send the original disk to a professional data recovery service.

Lastly mount the partition somewhere and see if you can access the data:
# mount /dev/sdb2 /mnt/data

"Rescue me, Oh take me in your arms, Rescue me" - Aretha Franklin

Related:

info ddrescue - full ddrescue manual
dd_rescue - written by Kurt Garloff for Debian
ddrescue for OS X - macosxhints
dd - Data Dump - Convert and copy a file



Back to the Top

Simon Sheppard
SS64.com