[NBLUG/talk] dd for different size partitions?

Kyle Rankin kyle at nblug.org
Tue Aug 10 13:22:42 PDT 2004


On Tue, Aug 10, 2004 at 01:16:58PM -0700, Bob Blick wrote:
> I want to resize partitions. I'm starting with a hard disk that has
> multiple partitions.
> 
> For a starting place, let's say I want to make the / partition (/dev/hda1)
> bigger and an adjacent partiton (/dev/hda2) smaller. I care about the /
> partition and don't care about the other partition although I will retain
> it with a new smaller size. So far so good.
> 
> I have plenty of room on /home, so I figured I'd copy the / partition onto
> a file on /home, resize and reformat the two other partitions, and copy
> the / partition back.
> 
> OK, so could I do this:
> 
> boot from a knoppix or other CD
> dd if=/dev/hda1 of=/dev/hda3/home/bob/my_partition_file
> then do my resizing and do this
> dd if=/dev/hda3home/bob/my_partition_file
> 
> But then I got to thinking that this really wouldn't work, because dd will
> screw up the partition because it is writing to a different size partition
> - basically I will end up with the same size partition, but it will take
> more room on the drive.
> 
> Any and all info on this is welcomed.
> 
> Cheerful regards,
> 
> Bob
> 

There are a few different ways to go about this. Since you are using
Knoppix, you could potentially just use the qtparted program it includes
(it's under the system menu) to resize the partition on the fly (if there's
enough free space of course).

Otherwise find piped to cpio is your best bet. I use this method all the
time to migrate to newer or other hard drives, and ended up explaining it
so often I just wrote it down in my tips section:

http://greenfly.org/tips/filesystem_migration.html

-- 
Kyle Rankin
NBLUG President
The North Bay Linux Users Group
http://nblug.org
IRC: greenfly at irc.freenode.net #nblug 
kyle at nblug.org




More information about the talk mailing list