using dd to copy partition to another partition, while using physical drive

I'm not sure how to explain this in the subject better, so the "question" may not be right. But here goes. I have three hard drives. Drive A is a 320GB drive, Drive B is a 80 GB Drive, and Drive C is a 1TB Drive. I've copied the data from the 80 GB drive over to the 1TB drive, and am going to resize the partition (so I can copy the data from the 320 GB drive over next).

My question is this: If I boot into the operating system on the 1TB drive, can I use dd to copy the 320 GB drive over to another partition on that physical drive? I know that I shouldn't copy a live partition over (meaning I couldn't copy the data from the 320 GB drive over if I'm running that operating system).

My reasoning is this: I tried using Acronis TrueImage, Partition Manager, and Image 4 DOS/Linux (both applications), and it was going to take over a week to copy the data over. That means that for a week, I'm not able to use the computer, which isn't acceptable (unless it's my only option). I'm hoping that this works, so I can at least use the computer while I'm doing the copy.

If I have to, I can either boot to a Live CD (not really a preferred option) or use "Drive B", but I'd like to remove that drive as soon as possible.


Yes, what you want to do will work fine, given the following two conditions are true:

  1. There is no (mounted) filesystem on the partition that you are dd'ing to.
  2. The partition you are dd'ing to is at least the same size as the one you're dd'ing from (i.e. 320 GB).

The reason that it will work fine is that partitions are just files in UNIX. Their contents only have special meaning if they contain a mounted filesystem.

Assuming you have a layout that looks like this:

1 TB = sda, two partitions, sda1 that you booted from and sda2 that you are dd'ing to

320 GB = sdb, one partition, sdb1 that you are dd'ing from

Your command would look like this:

dd if=/dev/sdb1 of=/dev/sda2 bs=1M

The bs=1M parameter is there to ensure that dd copies the data in large chunks instead of issuing a request for each sector.


In general its ok to dd any partition while it is not mounted. If you have to mount the source partition for reading while the dd runs, it would be better to mount it read only with the -o ro parameter.

if you want to first boot into the source partition amd then use dd to copy it, you can do mount -o ro,remount / to make it read only after booting.