I have a 1 TB internal drive that has two 1/2 TB partitions, one for Windows and the other for Ubuntu 14.04 LTS. The station has become primarily a Linux station and I never boot into Windows anymore.

I wanted to create an image backup so I used DD to clone the internal drive to an external 1 TB USB drive. Unfortunately the USB drive appears to be just a few Gigabytes shy of the internal drive and DD ended with a "Not enough space on drive" error message. Now I am seeing something odd. When I ejected the USB drive and plugged it back in, I see two 1/2 GB partitions that appear to be duplicates. They have identical GUID's and Nautilus shows identical directory structures and content. I'm guessing that something about the incomplete copy of one of the partitions has left the external drive in a broken state.

How can I use DD to just clone the Linux partition to the external drive? That's all I really want.


As first you need to find out data about your HDD, you can do this by typing in terminal:

sudo fdisk -l

You should get an output like this:

Disk /dev/sda: 149,1 GiB, 160041885696 bytes, 312581808 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x06bd4abe

Device     Boot     Start       End   Sectors   Size Id Type
/dev/sda1  *         2048 230055935 230053888 109,7G 83 Linux
/dev/sda2       292970494 312580095  19609602   9,4G  5 Extended
/dev/sda3       230055936 292968447  62912512    30G 83 Linux
/dev/sda5       292970496 312580095  19609600   9,4G 82 Linux swap / Solaris

Partition table entries are not in disk order.

So lets say /dev/sda3 is the drive you want to clone, then you can do:

dd bs=512 if=/dev/sda of=/dev/sdb1/partition.ddfile seek=230055936 count=$(expr 292968447 - 230055936)

Remind this here are only examples you would need to fit that to your situation.

  • Is there a reason for not just using if=/dev/sda3? Genuinely curious. – emk2203 May 11 '16 at 7:05
  • Just wanted to be sure to have only this partition, and as well not writing it into a file instead of a partition to make sure you can still see it somehow. – Videonauth May 11 '16 at 14:35

Easier way:

  1. sudo fdisk -l as said by Videonath. Locate the partition you wish to clone
  2. dd bs=512 if=/dev/<partition-name> of=/<external-media-path>

e.g.dd bs=512 if=/dev/sda2 of=/dev/sdb1


  • dd requires the size of the target to be grater or equal to the size of the source
  • The backup created this way (partition level) would not be bootable
  • 1
    How to make this bootable ?? – aashish Nov 22 '16 at 12:54

While you ask about dd, may I recommend partclone? It is made to clone and restore a partition. It needs to be aware of the underlying filesystem, advantage over dd is that it copies only the used blocks and saves a lot of time or space, since it is rare that the unused part of a partition is compressible (old data garbage instead of zeroes).

sudo partclone.ext4 -c -b -s /dev/sdaX -o /dev/sdbY 

will do what you want. -c stands for clone, -b for device-to-device, -s is source, -o is target. Also, since you did a clone, the UUIDs of source and target are identical. Check this with blkid, use uuidgen to generate a new UUID and then sudo tune2fs /dev/sdbY -U <uuidgen-generated new UUID> to change it.

Having two identical UUIDs on the same machine could even be the root cause of the issues you had with the 'broken' state of the external device.

Before you do this, the target device needs to be set up with fdisk so that the new partition is not smaller than the old partition. If it is larger, you can grow the cloned partition afterwards with gparted to the new maximum size.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.