Using dd and dd_rescue

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

Related posts:

  1. SCP and filename spaces Copying files with scp is difficult enough without spaces. So...
  2. Reset your MediaWiki Sysop Password When you’re stuck without sysop access to MediaWiki because you...
  3. Tunnelling on the fly I’ve just been tweaking with SSH. One of the common...
  4. No More Lost Deleted Files in Ubuntu I had a shocking error of judgement this morning when...

Related posts brought to you by Yet Another Related Posts Plugin.

You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>