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.
846 total views, 1 views today