Disk Cloning with dd

Hello my fellow Linux people,

After my boss unsuccessfully cloned a drive using clonezilla, he asked me to find a piece of software to use it. I'd like to boot into a live distro and use dd. I'm confused by this command. Would anyone be able to explain it?

Warning: This method will erase the destination completely and replace it with the content from your source.

dd if=/dev/sdx of=/dev/sdy

x and y are replaced by the letters of the drives you want as source and destination. The letters can be found by using the lsblk command or sudo fdisk -l

if is the "input file" aka the source drive you want to clone.
of is the "output drive", aka the drive you want to set as the destination.


you can also write iso and imgs to usb drives

dd if="NAME OF ISO" of=/dev/sdx

This will write the iso to whatever drive you want.


Also be careful you have drive parameters set up correctly. I would format it in gparted before hitting it or the next computer you use the drive with might think it has a 512kb cache or something stupid (this has happened to me more than once with not only drives, but also USB's).



So I could boot into a live distro use sudo fdisk -l w/o the external HDD, and then rerun the command to verify which of the sd(x) is the destination drive?


This is the part major part I don't understand is the memory cache parameter. How do I know which to put in there?

Yeah, you can do exactly that without an issue.

Also, about the cache, it's irrelevant to the situation. He's just saying make sure that you're erasing any other partitions prior to disk cloning.


Theres no param just make sure you format the drive separate instead of letting DD do it. Every time I do it with DD it screws up. Just use GParted or something and do it separately before cloning to that disk.

1 Like

Okay I see now. Finally, does this make a clone or an .iso image?

PS Real final question : This works if the source is Windows right?

1 Like

It will copy file for file from one drive to the other.

EXAMPLE: dd if=/dev/sda1 of/dev/sde1

1 Like

yep it copys it from byte to byte.

@FaunCB You will have to use dd if=/dev/sda of=/dev/sdb to copy stuff like mbr (leave out the numbers which identify the partition.


This will make a clone. It will copy byte for byte from source to destination.

Yes, just make sure you install the ntfs-3g package via apt-get.

sudo apt-get install ntfs-3g will give you the compatibility to read-write NTFS formatted partitions.


Alright! Thanks all!

such simple and powerful tools :)

I've used DD to clone the Windows install on my work laptop to an SSD hoping it would run faster... It really doesn't unfortunately. Now if I can get that install working in a VM we might get somewhere...

Okay I'm going to do this today.

Please let me know if the following sounds like a sold plan.

  1. Boot into live Ubuntu 14.04 (64-bit) environment.
  2. Use fdisk -l to list current drives (Prior to plugging in external HDD[the destination drive{y}]).
  3. Identify which is Windows drive (the source{x}).
  4. Plug in external drive run
  5. Run fdisk -l to identify the source drive.
  6. Run dd ff=/dev/sd{x} of=/dev/sd{y}
  7. Profit???

Am I going to need to format the destination HDD if it already has data on it?

yes just leave out the number to copy stuff like mbr

In the sense of, if the destination HDD already has a windows system image on it... should I use windows to format the hard drive before I do this? In other words, how do I prepare to do this if there already is data on the drive to write to and I want to get rid of it's current contents.

it would be smart to erase it ahead of time to prevent extra data from existing. other than that it copy ALL data from source drive to dest. drive. If the HDD has data on it then it would be overwritten.

1 Like

I completed this on Saturday and turned the HDD to my boss. I forgot to try to test it by booting from it, but I did verify that the files were written over and they had. Hopefully, my boss tests it soon and lets me know if it worked properly. I'll follow up with results.

Thanks everyone for helping out!

1 Like