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

Re: Swapping /usr and /



Andrew Overholt <overhol@ecf.utoronto.ca> writes:

> After install potato on my laptop, I realize that I would like to swap the
> partitions for /usr and / .. any idea how I can do this safely?  I managed
> to swap /home and /usr with little hassle but I'm kinda more concerned
> about / and /usr.

If / can fit completely on /usr (or vice-versa), then this is easy.

1. Go to single user mode

2. Move everything currently in /usr to 1 lower directory:

   cd /usr; mkdir usr; mv * usr

3. Copy / to /usr:

   cd /; find . -xdev -print0 | cpio -pvdm0 /usr

4. At this point, the / partition is redundant, and the old /usr
   partition has everything. Update lilo and fstab to reflect
   this. In fstab, remove the entry for /, and rename the entry for /usr
   to /. In lilo.conf, change the boot partition.

   vi /usr/etc/lilo.conf
   vi /usr/etc/fstab
   chroot /usr lilo -v

5. Reboot, and now / has become the old /usr partition. At this point,
   you can make a new filesystem on the old / partition, mount it, and
   copy /usr from the new partition to the old. Go back to single user
   mode and:

   mke2fs /dev/hdFOO
   mount /dev/hdFOO /mnt
   cd /usr
   find . -xdev -print0 | cpio -pdvm0 /mnt
   mv /usr /usr.dontuse
   mkdir /usr
   vi /etc/fstab

6. Reboot once more, and if everything looks good, rm -rf /usr.dontuse.

MAKE SURE YOU SAVE EVERYTHING IN /etc /var AND /usr/local BEFORE DOING
THIS. ALSO MAKE SURE THAT YOU HAVE A WORKING RESCUE DISK.

-- 
Dave Carrigan (dave@rudedog.org)            | Yow! Zippy's brain cells are
UNIX-Apache-Perl-Linux-Firewalls-LDAP-C-DNS | straining to bridge synapses...
Seattle, WA, USA                            | 
http://www.rudedog.org/                     | 



Reply to: