For backup purposes I periodically clone my hard drive.
To clone a drive using the Linux dd
command.
1- Make or get a Linux installation disk, the Live CD or USB. What follows is for Linux Mint Mate but any other Linux flavor is just as well.
2- With both he source and target drives plugged in to the computer, boot up from the separate Linux installation media.
3- Open the command prompt console and type:
sudo blkid
This will display a sequence of lines, one for every partition of every drive in the system scope,
/dev/sda1: LABEL="newmate2015" UUID="142698fe-5f97-4ca2-9a4c-3e20df" ...
/dev/sda2: ...
/dev/sdb1: ...
The number before the colon in /dev/sda<number>:
designates the partition number, and the letter before the number /dev/sd<letter><number>:
designates the drive.
4- In the dd
command line, the variable
if=
designates the source drive or the input file, and the
of=
variable designates the target drive or the output file.
5- To verify the correct source and target drive letters, we display the same assignment in a different way.
At the command prompt enter:
gnome-disks
6- If all is consistent, at the command prompt type:
dd if=/dev/sd<source-drive-letter> of=/dev/sd<target-drive-letter> conv=noerror,sync bs=4k
With the conv=sync,noerror
option dd
will not halt the transfer if a bit(s) in a source block can not be read, in that case to keep the transfer source and target drives at the same data position and of the same length, dd
will instead write an all zeros block of the correct length.
The bs=
argument is the transfer block size, and it also affects the cloning operation transfer bit rate, it can be determined by trial and error, 4k
works fine with most HDD, SSD and USB drives, CD drives use 512b
block size.
The target drive has to be of the same or larger capacity than the source drive. I use same size drives. Eventually when the target drive bad sector reallocation reserve capacity runs out the dd
command will fail.
On my simple computer it takes about 3 hours to clone a 1Tb disk drive
After cloning,
7 Shut down the machine normally.
8 Do Not Attempt to Boot a machine that has 2 drives with the same UUID.
9 Unplug the original source drive from the computer.
10 Boot Up and verify that the cloned drive boots normally.
11 Label or record the the removed drive with the: removed date, user, machine name, location, contents, s/n, etc.