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

Re: Help with Linux command

Syed Huq wrote:


If I want to swap the mount point and all it's content between /usr
and /home. What should I do ?

I realized that I made a mistake in the partition size between the two
and I would like to "swap"them. The disk space I originally intended
for /usr and /home needs to be swapped.


It's easiest if you have a third partition large enough to hold the smaller of your two /usr and /home partitions, although you can do it if you have enough free space for one of your partitions on the other, but it's messy.

It's very easy to mess up no matter how you do it. You'll want to boot into single-user mode (or better, boot off a LiveCD, such as Knoppix), copy/move the data, preserving permissions, unmount and remount with the new mount points, and edit /etc/fstab to reflect the new mount points.

I would boot off Knoppix, mount the /usr and /home partitions, along with a third empty partition, say "/spare"; then "cp -a /home /spare", double-check that did what I wanted, then "rm -rf /home"; "cp -a /usr /home", again double-checking that it did what I wanted (you don't want "/home/usr"; you want "/home[the files/dirs in /usr]"); then "rm -rf /usr"; and finally "cp -a /spare /usr" and "rm -r /spare". Then fix the mount point settings in /etc/fstab, and reboot.


Reply to: