Duplicate HD in Linux with 'dd'

Anything relates to software

Duplicate HD in Linux with 'dd'

Postby admin » Fri Jan 29, 2010 3:04 pm

Using dd you can create backups of an entire harddisk or just a parts of it. This is also usefull to quickly copy installations to similar machines. It will only work on disks that are exactly the same in disk geometry, meaning they have to the same model from the same brand.

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.
User avatar
admin
Site Admin
 
Posts: 938
Joined: Tue Jun 14, 2005 3:41 pm

Return to Software & Techniques

Who is online

Users browsing this forum: No registered users and 4 guests

cron