ghacks Technology News

dd: the ultimate disk cloning tool


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.


Debian Help has a more complete guide.




Tags: , , , , , , , , ,
Categories: Linux, Tools



Related posts:

Disk Copy Software
Disk Copy Software PC Network Clone
Protect Data DVDs And CDs With Power Disk Lock
The Ultimate Movie DVD Tool Collection
Disk Wipe Utility
HP USB Disk Storage Format Tool
Burn disc images quickly and for free
Analyse your hard disk and stop wasting space

11 Responses to “dd: the ultimate disk cloning tool”

  1. Paul. says:

    Hey Joe,do you know or those command also apply for openSUSE-11.1? And is it possible to change the command into, dd if=/dev/dvdrom of=image.iso bs=2k to write it to a dvd disk?

  2. if = input file
    of = output file

    That makes it easier to remember. And besides the nickname, what does “dd” really stand for?

  3. VD says:

    I always used Ghost as ist does have a boot-disk which lets you recover even without a running os. Seems to having difficulties with ntfs-partitions though (or my version is simply to old^^).

  4. LECHIFFRE FREDERIC says:

    I think dd stands for disk dump

  5. Casey says:

    This utility was originally “convert and copy,” however the name “cc” was already taken by the c compiler, so for some reason the author decided to make it “dd,” which earned its nickname “disk dump.

  6. Isn’t that the most awesome thing about Linux?

    You search for an app, and then you realize there’s a command as “complicated” as “dd”. Totally aweomse Joe, thanks!

  7. Dotan Cohen says:

    @Daniel:
    I know what you mean. I often find the CLI to be both easier to use and more intuitive than GUIs for many common tasks.

  8. rupert says:

    Personally, I prefer clonezilla:
    http://clonezilla.org/
    Just as powerfull and opensource, and is has a nice GUI to boot.

  9. Casey says:

    Clonezilla actually uses dd as one of it’s tools. Other tools it uses are ntfsclone for NTFS and partimage for just about everything else. The good thing about dd is that it will work regardless of file system type or if there are errors on the disk.

  10. Russ McClay says:

    dd is a common UNIX program whose primary purpose is the low-level copying and conversion of raw data. dd is an abbreviation for “dataset definition” in IBM JCL, and the command’s syntax is meant to be reminiscent of this.

    http://en.wikipedia.org/wiki/Dd_(Unix)

Leave a Reply   Follow Ghacks   Subscribe To Comment Rss

© 2005-2009 Ghacks.net. All Rights Reserved. Privacy Policy - About Us