Saturday, May 21, 2011

Linux Copy One Hard Disk to Another Using dd Command

Hard Disk Clone

dd command can copy disk in raw format. It will copy partition table and bootloader and all partitions within this disk. For example, you can copy /dev/sda to /dev/sdb (same size) using the following dd command. dd should complete with no errors, but output the number of records read and written.

Login as the root user (use sudo or su command)

dd if=/dev/sda of=/dev/sdb

if=/dev/sda : Input disk (source)
of=/dev/sdb : Output disk (destination)

Making a Hard Disk Image File
dd if=/dev/sda of=~/disk1.img

Partition Clone
dd if=/dev/sda1 of=~/disk2.img

Restoring from an Image File
dd if=disk1.img of=/dev/sda

No comments:

Post a Comment