Warning
dd is a powerful but also dangerous tool. Check and double-check, that everything is correct before you launch the command lines! dd does what you tell it to do without questions. A small mistake (typing error) can make you overwrite and destroy valuable documents, for example the family pictures.
Command lines
Text after the # character is a comment for the human eye, not used by the shell interpreter.
If you are sure that /dev/sdx is the correct target device, you can use the command
sudo dd if=/dev/sda of=/dev/sdx bs=64K # should be upper case K
to clone the drive to the device /dev/sdx, where x can be b, c, ...
If you want to create an image file (without compression), you can use the command
sudo dd if=/dev/sda of=dd-clone.img bs=64K # should be upper case K
If you want to create a compressed image file, you can use the command
sudo -s # to get the root prompt `#`
dd if=/dev/sda bs=64K | xz -c > dd-clone.img.xz
exit # to get the user prompt `$`
Such a compressed image can be extracted with
sudo -s # get the root prompt `#`
xzcat dd-clone.img.xz > dd-clone.img # get a big uncompressed file
xzcat dd-clone.img.xz | dd of=/dev/sdx bs=64K # clone to `/dev/sdx`
exit # get the user prompt `$`
Tips
If you want the compression to be more efficient, you should overwrite the free drive space with zeros. You can do that in the following way:
Use zerofree for linux ext partitions.
Mount other partitions and use the following command lines for partitions with other file systems. Let us assume that you have mounted a partition at the mountpoint /mnt, and that the whole drive is used for partitions. Check that you have mounted a partition there! Otherwise you will fill the root partition and your running operating system will stop working.
sudo dd if=/dev/zero of=/mnt/blank bs=4096 # Let it fill the partition
sudo rm /mnt/blank
See Tools at this link: SanDisk SSD Plus: Half the performance on Linux than on Windows?
Alternative
Clonezilla is an alternative to dd. It is safer and it is faster, particularly if there is a lot of free space. Clonezilla will only copy used blocks (and skip free blocks), which will make the copy much faster, particularly if a fair part of the main partition /dev/sda3 is free (not used by files).