GNU dd_rescue is a program that can be used to recover data from a disk with errors. For example a hard disk with some bad sectors. It is a modified version of dd with 2 features that make it great for rescuing data from a failing hard drive. The first is you can tell dd_rescue to start from the end of a file (disk) and move backwards. Second, it uses two block sizes, a large (soft) block size and a small (hard) block size. In case of errors, the size falls back to the small one and is promoted again after a while without errors.
A simple example of what a rescue might look like with dd_rescue is below. Be sure to read the read me file and man page for more info.
Installing on Ubunutu is as easy as "sudo apt-get install gddrescue".
1.
dd_rescue /dev/hda1 /home/pantz/brokedrive_hda1.img
2. Wait a long ass time.
3. Setup image as a device.
losetup /dev/loop1 /home/pantz/brokedrive_hda1.img
4. Mount it (you have to know your filesystem).
mount -t ext3 /dev/loop1 /media/cdrom
5. Change to the dir where the rescue image is mounted.
cd /media/cdrom
6. Look all all your files hopefully.
ls -la
Other free disk recovery software that you might check out is PhotoRec or TestDisk.
I've never used dd before to copy disks. It's a unix tool that copies files bit by bit. Since hard disks on unix systems are just represented as files you can do exact copies of them with it. It's strength is really it's weakness. It copies all the data on the disk if you tell it to copy your harddrive. That means everything. Even data that is was on the disk before but was not written over. Unless you wipe the disk with a disk wiping program (writing zero's across it) the previous data (if there was any) is still there. Copying every bit means it takes a very long time. We are talking hours to copy a disk. But your copy is exact. Partition info, boot sector info, everything.
I wanted to copy everything off the disk and send it over the network. So we can do it with ssh. First zero out the non used space on the running disk to make compressing the image much eaiser. Using the command:
dd if=/dev/zero of=0bits bs=20M; rm 0bits
Then boot knoppix (or any other bootable linux distro like sysrescuecd) from the machine you want to image and give the command:
dd if=/dev/sda | gzip -1 - | ssh user@hostname dd of=image.gz
Assuming sda is your hard drive. This sends the local disks data to the remote machine. To restore the image boot knoppix on the machine to restore and pull the image that you created and dump it back with the command:
ssh user@hostname dd if=image.gz | gunzip -1 - | dd of=/dev/sda
This will usually take a few hours so be prepared. A good site that has some info on using ssh this way is here.