Backup and Restore entire hard disk with dd command

This post was written by admin on October 7, 2009
Posted Under: Backup


Full hard disk copy:

dd if=/dev/hdx of=/dev/hdy
dd if=/dev/hdx of=/path/to/image
dd if=/dev/hdx | gzip > /path/to/image.gz

Hdx could be hda, hdb etc. In the second example gzip is used to compress the image if it is really just a backup.

Restore Backup of hard disk copy:

dd if=/path/to/image of=/dev/hdx

gzip -dc /path/to/image.gz | dd of=/dev/hdx

MBR backup:

In order to backup only the first few bytes containing the MBR and the partition table you can use dd as well.

dd if=/dev/hdx of=/path/to/image count=1 bs=512

MBR restore:

dd if=/path/to/image of=/dev/hdx

Add “count=1 bs=446″ to exclude the partition table from being written to disk. You can manually restore the table.

Related posts:

  1. Backup and Restore Ubuntu system with Sbackup
  2. How to Backup your data on to a shared network drive
  3. How to restore Grub 2 after reinstalling Windows XP/Vista/Win7
  4. Create backup of all installed packages in ubuntu
  5. Simple Backup tool for Ubuntu

    Tags:

    Add a Comment

    required, use real name
    required, will not be published
    optional, your blog address