Posts Tagged ‘dd_rescue’

Using dd and dd_rescue

Tuesday, September 11th, 2007

Following up on a post about recovering bad disks and reiser file systems, here is a list of ddrescue commands to help make life that little bit easier:

Backup MBR (boot code + partition table):
dd if=/dev/hda of=mbr count=1 bs=512
Restore boot code + partition table:
dd if=mbr of=/dev/hda
Restore, not including partition table:
dd of=/dev/hda if=mbr bs=448 count=1

Saving partition sizes to text file:
fdisk -l /dev/hda >partition-info.txt

Backing up to gzipped file:
dd if=/dev/hda | gzip >hda.gz
Restoring:
gunzip -c hda.gz | dd of=/dev/hda

Backing up to archive split into 1GB chunks:
dd if=/dev/hda | split -b 1024m -d - hda.
Restoring:
cat hda.* | dd of=/dev/hda

Backing up over ssh tunnel to remote machine (blowfish = faster):
dd if=/dev/hda | ssh -c blowfish user@machine "dd of=hda"

copying files over ssh tunnel:
tar cv /source | ssh -c blowfish user@machine "cd /destination ; tar x"

Thanks to colinm over at Digg for putting these so succinctly