Resizing partitions and copying data with dd

Alfred Hovdestad alfred.hovdestad at usask.ca
Sat Mar 4 15:05:30 UTC 2006


You could also try using Knoppix.

1. Boot up Knoppix.
2. Create the new partition
3. Create the directories on the new partition
    mkdir /var, /usr, /home or whatever
4. Copy the mount points off the old disk to the directory on the new 
partition using tar
    cd /olddisk
    tar cf - var | (cd /newdisk; tar xpf -)
5. Remove the mount points on the old disk
    rm -fr /olddisk/var
6. Copy the root partition last
    cd /olddisk
    tar cf - * | (cd /newdisk; tar xpf -)


I have used this method to replace a smaller drive with a bigger drive 
several times.  The nice thing about using Knoppix is that none of the 
files are open when you copy them.  Since you are copying partitions, 
tar copies the lost+found as well.  Be sure to go into the new directory 
and remove the lost+found directory.

    Alfred Hovdestad, RHCA
    University of Saskatchewan



McDougall, Marshall (FSH) wrote:
> Thanks, Mike, but that didn't work either.  It wanted to take
> everything, including all the data from the other mounts, and put it
> under /newroot, not just the / contents.
> 
> Regards, Marshall 
> 
> -----Original Message-----
> From: redhat-list-bounces at redhat.com
> [mailto:redhat-list-bounces at redhat.com] On Behalf Of Mike Wooding
> Sent: Wednesday, March 01, 2006 6:48 PM
> To: General Red Hat Linux discussion list
> Subject: Re: Resizing partitions and copying data with dd
> 
> 
> 
> --- "McDougall, Marshall (FSH)" <MarMcDouga at gov.mb.ca> wrote:
> 
> 
>>I am trying to move my root mount to a bigger partition without
>>tearing
>>down the whole machine.  I created a new ext3 partition of 10G.  I
>>then
>>tried to copy my existing root partition to the new partition using:
>>
>> dd if=/dev/oldroot of=/dev/newroot
>>
>>It worked great except my newroot is 2G, not 10.  I tried using
>>ext2online but there are some incompatibilities, or so it thinks.
>>Anyone have a suggestion on how I can move my root mount to a new 10G
>>partition without any catastrophe?  Thanks.
> 
> 
>  The "dd" command didn't copy files, it copied the filesystem,
>  superblock and all.
> 
>  Make a new FS on /dev/newroot mount it and use something like
>  cpio (find / | cpio -pmduv /newroot) to copy the files.
> 
> 
> 
> He who laughs last thinks slowest.
> 
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around 
> http://mail.yahoo.com 
> 




More information about the redhat-list mailing list