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: ddrescue, gddrescue, recovery, Ubuntu
Posted by Hans-Henry Jakobsen
This post describes how you can backup your partition table for future recovery.
This example describes how you can backup the disk partition table on /dev/sda
dd if=/dev/sda of=sda.mbr bs=512 count=1
It’s also useful to keep a human readable copy of the disk layout for future reference
sudo fdisk -l > partitions.lst
This example shows how you can recover your file system using your partition table backup.
dd if=sda.mbr of=/dev/sda bs=512 count=1
This is a nice way to keep the information about your file system and will it help you in the future if you get disk corruption.
This does not only apply to linux partitions but all types of partitions.
Tags: backup, dd, fdisk, recovery
Posted by Hans-Henry Jakobsen