Penguin

Erase a Harddrive (zero fill)

This command attempts to write a zero at every writable location on your hard drive. Before using the command, I recommend triple checking that you are indeed erasing the correct harddrive!

  • dd if=/dev/zero of=/dev/hda bs=1M

Clone a Harddrive

Lets say that /dev/sda is the hdd we wish to clone, and that /dev/sdb is an empty drive that is to be used as the target.

  • dd if=/dev/sda of=/dev/sdb bs=1M

Note : the destination harddrive should be equal or larger in size to the source harddrive.


Clone a CD/DVD

  • dd if=/dev/cdrom of=/here/is/a/path/mycdrom.iso

How to backup and restore your MBR

Including the partition table.

Backup : dd if=/dev/sda of=/backup/mbr.bkp bs=512 count=1
Restore : dd if=/backup/mbr.bkp of=/dev/sda bs=512 count=1

Excluding the partition table (only the executable code area)

Backup : dd if=/dev/sda of=/backup/mbr.bkp bs=446 count=1
Restore : dd if=/backup/mbr.bkp of=/dev/sda bs=446 count=1