I recently had to clone a hard disk so I naturally turned to solutions such as Acronis True Image, but I discovered these did not work (the start-up disk claimed the clong was 'complete' when it blatantly wasn't) and I also tried copying the partition using gParted in Ubuntu but this froze at about 3%, due to corrupt data, which seemed not to be caught in a chkdsk.
I was about to give up hope and copy the files manually when I came across an extremely powerful, yet simple, Unix command: dd.
Using a Linux live disc, dd can be used to copy files, disks and partitions. It can output directly onto another disc or as an image (like an iso).
dd copies data byte-exactly, meaning it won't get stuck should it encounter corrupted or fragmented data.
dd is nicknamed 'destroy disk' as mistyping one letter can wipe your hard disk, so caution must be used.
To copy a hard disk, one would use the following command (whilst root):
dd if=/dev/hdx of=/dev/hdy
hdx is the input hard disk (to be copied) and hdy is the output hard disk (where it is to be copied to).
if = input
of = output
This is extremely important to remember and their names must be altered according to how they are on your computer (use a tool like gParted to find out your drive's paths). For example, your 'if' may be /dev/sdb whilst your 'of' may be /dev/sda, but this obviously varies according to how you want to use it and computer-by-computer so you MUST check. An extremely intelligent friend of mine accidentally wiped a hard drive using this command!
Another use would be to use it to produce a CD image:
dd if=/dev/cdrom of=image.iso bs=2k.
Advertising revenue is falling fast across the Internet, and independently-run sites like Ghacks are hit hardest by it. The advertising model in its current form is coming to an end, and we have to find other ways to continue operating this site.
We are committed to keeping our content free and independent, which means no paywalls, no sponsored posts, no annoying ad formats (video ads) or subscription fees.
If you like our content, and would like to help, please consider making a contribution:
Ghacks is a technology news blog that was founded in 2005 by Martin Brinkmann. It has since then become one of the most popular tech news sites on the Internet with five authors and regular contributions from freelance writers.