Mini How To

Clone A Drive With dd

“Mini How To” Clone A Drive With dd

Cloning under Windows always requires a third party application.  In Linux we can use a build in command to clone a drive.

Why And When Would You Need This.

You can use this for a number of applications.

  • Imaging a drive to a iso file.
  • Clone a defective harddrive to save data.
  • Replace a harddrive for a bigger one.

Keep in mind that there are more efficient ways of doing this.  But if you need to clone a drive or make an image of a hard drive, and you only have access to a Live CD.  Then using dd is a great way to do this.  Also it does not matter if the harddrive has ntfs of ext3 or any of the other file systems dd will image the harddrive not matter what file system is on the drive.

How Does It Work

The command dd makes a bit for bit copy of the hard drive.  This is part of the reason why dd takes a while to image a hard drive.  The command:

dd if=/dev/sda of=/dev/hda bs=16384 conv=notrunc,noerror

What do these options mean?

if= The Input file, read the drive that you are going to clone.

of=The Output file, the drive that you need to write to.

bs= Blocksize I set this option to 16384 because larger blocksize means a faster file transfer.

conv=Conversion converts the file according to the arguments applied.  Where notrunc means do not truncate the file.  Noerror means do not stop on any read errors this could be a potential problem if you have a drive full of errors.

of course you will need to find out what drive is which run the following command for this.:

sudo fdisk -l

Make sure that the if (input file) is the right drive if you start dd with the wrong if and of then you will wipe the drive you want to clone.

If you have any problems following this how to or want to leave a comment then please do so bellow. Or send me an e-mail.

Powered by: Wordpress