How to backup exact copy of hard drive using Linux

From the man page, dd is a Unix tool to “copy a file, converting and formatting according to the operands”.

To raw copy or backup a hard drive is to “copy” the block device file itself, probably to a file, or directly to another harddisk.

Assuming the hard drive to be copied is /dev/sda, and the target is another harddisk detected as /dev/sdb, the following command will duplicate /dev/sda to /dev/sdb

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

In this example, the option if is for the input file, and of is for the output file.

The content of both disk should be the same, including the MBR, partition table, and all the data. Just make sure the target disk is bigger in size than the source.