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.
2Like a biological clone, the intention is that the copy is complete, fully functional and capable of action independant of the original. – Mokubai – 2017-06-28T18:56:20.730
1It is important not note that, while, as explained below, "cloning" is technically taken to mean making an exact copy, complete with OS, etc, it is apt to be used "casually" to simply mean copying off some large subset of the files. You need to establish what is actually meant in the real-life context. – Daniel R Hicks – 2017-06-29T01:42:18.550
also note that booting from USB drive is going to be slower than booting from normal SATA drive – jena – 2017-06-29T12:31:56.213
All the answers are great. I had hard time choosing one. Even though gronostaj is very thorough in his answer, I ended up choosing ianc1215, because he did provide simple explanation and answer with list of software that are available to do this with. I finally cloned my whole hardrive using Macrium Reflect Software Free Version and when you restore the cloned hardrive you get EVERYTHING back not just your files but drivers, operating system and all the programs you've installed. It is an exact copy of my old hardrive. Awesome. Thank you for all the replies. – ThN – 2017-06-30T12:54:59.370
1Cloning a system HD and boot on another machine will work as you expect only if the PC has the same hardware. – giammin – 2017-07-05T18:06:35.920
@giammin That's factually inaccurate.... For an OS like Android, which is compiled with a specific device's drivers only, that would be factual, but for an OS like Windows, Ubuntu, etc. it's wholly inaccurate. Most, if not all, modern day desktop OSes contain drivers for core system hardware, and while the system will not run in an optimal state if the OS drive is booted from a system with different Chipset, IMEI, etc. drivers, it will still boot and run. – JW0914 – 2018-08-06T03:39:55.740