Txt. copy from: http://sattia.blogspot.com/2015/03/linux-save-and-recover-data-from.html
# apt-get install gddrescue (# yum install ddrescue) ->Complete!
You need to use a logfile to resume a rescue.
Never ever run ddrescue on a read/write mounted partition.
Do not try to repair a file system on a drive with I/O errors.
Be careful about destination partition/device, any data stored there will be overwritten.
In this example rescue a /dev/sda to /dev/sdb
## No need to partition /dev/sdb beforehand, but if the partition table on /dev/sda ##
## is damaged, you will need to recreate it somehow on /dev/sdb. ##
ddrescue -f -n /dev/sda /dev/sdb logfile
ddrescue -d -f -r3 /dev/sda /dev/sdb logfile
## get list of partitions on a /dev/sdb ##
## check for errors ##
fsck -v -f /dev/sdb1
fsck -v -f /dev/sdb2
Understanding ddrescue command options
-f : Overwrite output device or partition.
-n : Do not try to split or retry failed blocks.
-d : Use direct disc access for input file.
-r3 : Exit after given three (3) retries (use -1 as infinity retries).
-b2048 : Sector size of input device [default is set to 512].
Example: Rescue a partition in /dev/sda3 to /dev/sdb3 in Linux
## You need to create the sdb2 partition with fdisk first. sdb2 should be of appropriate type and size ##
ddrescue -f -n /dev/sda2 /dev/sdb2 logfile
ddrescue -d -f -r3 /dev/sda2 /dev/sdb2 logfile
e2fsck -v -f /dev/sdb2
mount -o ro /dev/sdb2 /mnt
## Rread rescued files from /mnt ##
## Copy files using rsync ##
rsync -avr . firstname.lastname@example.org:/data/resuced/wks01
Example: Rescue/recover a DVD-ROM in /dev/dvdom on a Linux
The syntax is:
ddrescue -n -b2048 /dev/dvdrom dvd-image logfile
ddrescue -d -b2048 /dev/dvdrom dvd-image logfile
Please note that if there are no errors (errsize is zero), dvd-image now contains a complete image of the DVD-ROM and you can write it to a blank DVD-ROM on a Linux based system:
# growisofs -Z /dev/dvdrom=/path/to/dvd-image
Example: Resume failed rescue
In this example, while rescuing the whole drive /dev/sda to /dev/sdb, /dev/sda freezes up at position XYZFOOBAR (troubled sector # 7575757542):
## /dev/sda freezes here ##
ddrescue -f /dev/hda /dev/hdb logfile
## So restart /dev/sda or reboot the server ##
## Restart copy at a safe distance from the troubled sector # 7575757542 ##
ddrescue -f -i 7575757542 /dev/sda /dev/sdb logfile
## Copy backwards down to the troubled sector # 7575757542 ##
ddrescue -f -R /dev/sda /dev/sdb logfile
A note about dd_rescue command and syntax
On Debian / Ubuntu and a few other distro you end up installing other utility called dd_rescue. dd_rescue is a program that copies data from one file or block device to another, it is a tool to help you to save data from crashed partition.
To make exact copy of /dev/sda (damaged) to /dev/sdb (make sure sdb is empty) you need to type following command:
# ddrescue /dev/sda /dev/sdb
Naturally, next step is to run fsck on /dev/sdb partition to recover/save data. Remember do not touch originally damaged /dev/sda. If this procedure fails you can send your disk to professional data recovery service. For example if /home (user data) is on /dev/sda2, you need to run a command on /dev/sdb2:
# fsck /dev/sdb2
Once fsck run, mount /dev/sdb2 somewhere and see if you can access the data:
# mount /dev/sdb2 /mnt/data
Finally, take backup using tar or any other command of your own choice. ddrescue command supports tons of options, read man page for more information:
# man dd_rescue
OR see gnu/ddrescue command man page:
# man ddrescue