Sometimes you may want to clone your entire hard disk quickly. You may need an exact replica of your hard disk.
This can be done using the following command as root user:
dd if=/dev/sda of=/dev/sdb
if=/dev/sda is the source hard disk
of=/dev/sdb is the destination hard disk
Wasn’t that quick enough :). Do be careful in not mixing the source and destination disk above.
To make an image of your hard disk in case you don’t have a second hard disk use the command below:
dd if=/dev/sda of=~/disk1.img
To restore above image file run command:
dd if=disk1.img of=/dev/sda