====== Cloning a Hard Drive ====== The below command make a bit to bit copy of your hardriwe sudo dd if=/dev/sda of=/dev/sdb conv=sync,noerror With: * /dev/sda is the input(source drive) * /dev/sdb is the output(target drive) * sync,noerror must be used in combination, so dd will not stop if it encounter an error by reading the input. For more information read the [[http://en.wikipedia.org/wiki/Dd_%28Unix%29|Wikipedia page]] about dd. ===== Requirements ===== * You must be root (use sudo) * The target harddrive must have the same or a bigger size than the source harddrive. * The both harddrives must be unmounted. * Make sure your don't need your computer in the next days * Make sure your computer is in a room where it will not disturb or be disturbed by anyone ===== Example: bit to bit copy of a 1TB harddrive ===== I made a clone of my [[computer_science:hardware#my_harddrives|SAMSUNG HD103SJ 1TB 7200T]] to [[computer_science:hardware#my_harddrives:Seagate Barracuda ST2000DM001]] 2TB using my [[computer_science:hardware:asus_eeepc-1005_pe|EeePC]] and two [[http://www.manhattan-products.com/hi-speed-usb-20-auf-sata-ide-adapter|SATA to USB2 Adapters]]. I do not recommend this hardware configuration, better will be to plug the two HDDs in your desktop computer, but mine is ten years old and the motherboard don't have SATA connectors :-?. The source disk was encrypted using crypsetup. It took 320488 seconds => 5341.46 minutes => 89 hours => 3.7 days to dd mya 1TB HDD on a 2TB HDD. Below the output of dd: thomas@thomas-1005PE:~$ sudo dd if=/dev/sdc of=/dev/sdd conv=sync,noerror [sudo] password for thomas: dd: reading `/dev/sdc': Input/output error 421304+0 records in 421304+0 records out 215707648 bytes (216 MB) copied, 40.9582 s, 5.3 MB/s dd: reading `/dev/sdc': Input/output error 421304+1 records in 421305+0 records out 215708160 bytes (216 MB) copied, 42.1408 s, 5.1 MB/s dd: reading `/dev/sdc': Input/output error 421304+2 records in 421306+0 records out 215708672 bytes (216 MB) copied, 43.3579 s, 5.0 MB/s dd: reading `/dev/sdc': Input/output error 421304+3 records in 421307+0 records out 215709184 bytes (216 MB) copied, 44.5749 s, 4.8 MB/s dd: reading `/dev/sdc': Input/output error 1212908+4 records in 1212912+0 records out 621010944 bytes (621 MB) copied, 178.415 s, 3.5 MB/s dd: reading `/dev/sdc': Input/output error 1492411+5 records in 1492416+0 records out 764116992 bytes (764 MB) copied, 227.273 s, 3.4 MB/s dd: reading `/dev/sdc': Input/output error 1492411+6 records in 1492417+0 records out 764117504 bytes (764 MB) copied, 228.499 s, 3.3 MB/s dd: reading `/dev/sdc': Input/output error 1492411+7 records in 1492418+0 records out 764118016 bytes (764 MB) copied, 229.732 s, 3.3 MB/s dd: reading `/dev/sdc': Input/output error 1492411+8 records in 1492419+0 records out 764118528 bytes (764 MB) copied, 231.115 s, 3.3 MB/s dd: reading `/dev/sdc': Input/output error 1492411+9 records in 1492420+0 records out 764119040 bytes (764 MB) copied, 233.185 s, 3.3 MB/s dd: reading `/dev/sdc': Input/output error 1492411+10 records in 1492421+0 records out 764119552 bytes (764 MB) copied, 234.41 s, 3.3 MB/s dd: reading `/dev/sdc': Input/output error 1492411+11 records in 1492422+0 records out 764120064 bytes (764 MB) copied, 235.669 s, 3.2 MB/s dd: reading `/dev/sdc': Input/output error 1492411+12 records in 1492423+0 records out 764120576 bytes (764 MB) copied, 237.317 s, 3.2 MB/s dd: reading `/dev/sdc': Input/output error 2322179+13 records in 2322192+0 records out 1188962304 bytes (1.2 GB) copied, 377.092 s, 3.2 MB/s dd: reading `/dev/sdc': Input/output error 2322179+14 records in 2322193+0 records out 1188962816 bytes (1.2 GB) copied, 378.334 s, 3.1 MB/s dd: reading `/dev/sdc': Input/output error 3684321+15 records in 3684336+0 records out 1886380032 bytes (1.9 GB) copied, 608.109 s, 3.1 MB/s dd: reading `/dev/sdc': Input/output error 3684321+16 records in 3684337+0 records out 1886380544 bytes (1.9 GB) copied, 609.343 s, 3.1 MB/s dd: reading `/dev/sdc': Input/output error 3684321+17 records in 3684338+0 records out 1886381056 bytes (1.9 GB) copied, 610.618 s, 3.1 MB/s dd: reading `/dev/sdc': Input/output error 3684321+18 records in 3684339+0 records out 1886381568 bytes (1.9 GB) copied, 611.851 s, 3.1 MB/s dd: reading `/dev/sdc': Input/output error 3684321+19 records in 3684340+0 records out 1886382080 bytes (1.9 GB) copied, 613.077 s, 3.1 MB/s dd: reading `/dev/sdc': Input/output error 3684321+20 records in 3684341+0 records out 1886382592 bytes (1.9 GB) copied, 614.302 s, 3.1 MB/s dd: reading `/dev/sdc': Input/output error 3684321+21 records in 3684342+0 records out 1886383104 bytes (1.9 GB) copied, 615.528 s, 3.1 MB/s dd: reading `/dev/sdc': Input/output error 5216426+22 records in 5216448+0 records out 2670821376 bytes (2.7 GB) copied, 876.311 s, 3.0 MB/s dd: reading `/dev/sdc': Input/output error 5216426+23 records in 5216449+0 records out 2670821888 bytes (2.7 GB) copied, 877.536 s, 3.0 MB/s dd: reading `/dev/sdc': Input/output error 5216426+24 records in 5216450+0 records out 2670822400 bytes (2.7 GB) copied, 878.778 s, 3.0 MB/s dd: reading `/dev/sdc': Input/output error 5216426+25 records in 5216451+0 records out 2670822912 bytes (2.7 GB) copied, 880.004 s, 3.0 MB/s dd: reading `/dev/sdc': Input/output error 5216426+26 records in 5216452+0 records out 2670823424 bytes (2.7 GB) copied, 881.229 s, 3.0 MB/s dd: reading `/dev/sdc': Input/output error 5216426+27 records in 5216453+0 records out 2670823936 bytes (2.7 GB) copied, 882.463 s, 3.0 MB/s dd: reading `/dev/sdc': Input/output error 5216426+28 records in 5216454+0 records out 2670824448 bytes (2.7 GB) copied, 883.696 s, 3.0 MB/s dd: reading `/dev/sdc': Input/output error 5216426+29 records in 5216455+0 records out 2670824960 bytes (2.7 GB) copied, 884.93 s, 3.0 MB/s dd: reading `/dev/sdc': Input/output error 101456890+30 records in 101456920+0 records out 51945943040 bytes (52 GB) copied, 16783 s, 3.1 MB/s dd: reading `/dev/sdc': Input/output error 491670505+31 records in 491670536+0 records out 251735314432 bytes (252 GB) copied, 80749.2 s, 3.1 MB/s 1953525136+32 records in 1953525168+0 records out 1000204886016 bytes (1.0 TB) copied, 320488 s, 3.1 MB/s thomas@thomas-1005PE:~$ Despite of the input/ouput errors the copy worked and I was able to open the encrypted partition and to mount it on my linux system.