Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

Thanks, and have a great weekend.:)

Patrick.

share|improve this question

migrated from serverfault.com Feb 17 '13 at 3:44

This question came from our site for professional system and network administrators.

    
Sure, why not ? –  Michael Hampton Feb 16 '13 at 4:13

2 Answers 2

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.

share|improve this answer
    
if=source of=destination i think there's something wrong in the advice above. –  Shakunthala Rajan Sep 7 at 8:50
    
In the example above, sdb1 is the source and sda2 is the destination. I edited the answer to be more clear about that. –  Michael Fenn Sep 10 at 16:28

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.

share|improve this answer
    
Read only doesn't mean the filesystem isn't fooling around with the journal or reorganizing free space or whatever. –  vonbrand Feb 17 '13 at 12:59
    
@vonbrand could you provide an example of linux filesystem implementation that does that while in RO mode? –  Basilevs Sep 7 at 9:00

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.