Dd

On Unix-like operating systems, the dd command copies a file, converting the format of the data in the process, according to the operands specified.


Clone disk

$dd if=/dev/sdX of=/dev/sdY bs=64K conv=noerror,sync

Clone partition

$dd if=/dev/sdx1 of=/dev/sdy1 bs=64K conv=noerror,sync

Save to IMG

$dd if=/dev/sdX of=/path_to_an_image.img bs=64K conv=noerror,sync

Restore from IMG

$dd if=/path_to_an_image.img of=/dev/sdX bs=64K conv=noerror,sync

Clone from bigger to small disk/partition

#partition
$dd if=/dev/sdx1 of=/dev/sdy1 bs=64K conv=noerror,sync
#disk
$dd if=/dev/sdX of=/dev/sdY bs=64K conv=noerror,sync

You need to ensure the partition/disk can receive the datas - you will get errors, but the copy is (normally) ok.


Date : 2020.10.13