[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Rearranging partitions WAS: Re: Question??




On Fri, 1 Nov 1996, Martin Stromberg wrote:

> > What do I need to consider when copying "/" to another partition? Reason
> > I ask is I would like to put it in partition which had dos. Here is what
> > I would like to do:
> > 
> > Old setup:
> > 
> > hda1 -- dos
> > hdb1 -- swap
> > hdb2 -- /
> > hdb3 -- /home
> > 
> > New setup:
> > 
> > hda1 -- / {/etc, /boot, /bin, /lib, /sbin, /proc, /var, /tmp, /cdrom,
> > /mnt,
> >             /floppy}
> > hdb1 -- swap
> > hdb2 -- /usr
> > hdb3 -- /home
> >  
> 
> Well, this is how I would do it, supposing you don't have anything on that FAT
> partition you want to keep.
> 
> umount /dev/hda1
> mke2fs /dev/hda1
> mount /dev/hda1 /mnt
> cp -a /etc /boot /bin /lib /sbin /var /tmp /cdrom /floppy /mnt
> mkdir /mnt/proc
> Edit /mnt/etc/lilo.conf so it's using hda1 instead of hdb2 and run lilo.
> Edit /mnt/etc/fstab to reflect the changes.
> Reboot. Now the system ought to boot having the hda1 partition as / and the
> previous / on /usr.
> cd /usr
> rm -fr etc boot bin lib sbin proc var tmp cdrom mnt
> mv usr/* usr/.??* .
> rm -fr usr

     Not very good; you'll have problems with symlinks, special files in 
/dev, etc. Try:

umount /dev/hda1
mke2fs /dev/hda1
mount /dev/hda1 /mnt
umount /home
cd /
find ./ | grep -v /mnt/ | cpio -pdmv /mnt

Edit lilo to point to your new root and reboot. After reboot:

mount /dev/hdb2 /mnt
rm -rf /mnt/*
cd /usr
find ./ | cpio -pdmv /mnt
umount /mnt
rm -rf /usr
mkdir usr
mount /dev/hdb2 /usr

     If you don't have enough space in /dev/hda1 to hold everything, you 
can take a few more steps to copy directories individually instead of all 
your tree. The key is to use cpio and to *always* exclude the destination 
directory from the list of files to be copied (otherwise, you'll just 
fill up your disk). Check the line

"find ./ | grep -v /mnt/ | cpio -pdmv /mnt"

 It tells you everything.

See ya,
Nelson
lago@that.com.br

--
TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to
debian-user-REQUEST@lists.debian.org . Trouble? e-mail to Bruce@Pixar.com


Reply to: