The procedure will move most commands temporarily to a different directory, so it may not work while you are logged in as a normal user in a GUI. It will work from recovery mode. Reboot your computer, hit shift a few times to get the grub menu (if you don't get it automatically) and select recovery mode. When you get to a menu, select Drop to root shell prompt. You are now logged in as root with a minimum of software running.
Remount the root file system as read-write
Code:
mount -o rw,remount /
Next make a temporary mountpoint for your /dev/sda7 and mount it
Code:
mkdir /media/temp
mount /dev/sda7 /media/temp
You can use any name you want, as long as the directory doesn't exist yet.
At this point most commands in your system will have moved out of your PATH so you cannot access them by simply typing them, but you need to prefix them with /media/temp/bin/. This has freed your /usr directory, to which you can copy all contents of your old /dev/sda7. This will take some time.
Code:
/media/temp/bin/rsync -aXS /media/temp/. /usr/.
Now you have moved your /usr. For the moment you can keep everything on sda7 too as a backup.
Code:
mkdir /media/temp/old_usr
mv /media/temp/* /media/temp/old_usr
This may complain that it can't move old_usr to a subdir of itself. Don't worry. Next you can move your /home
Code:
rsync -aXS --exclude='/*/.gvfs' /home/. /media/temp/.
This may again take some time.
Afterwards you can change fstab to change the mountpoint of sda7. Create a backup of /etc/fstab and open it for editing
Code:
cp /etc/fstab /etc/fstab.old
nano /etc/fstab
nano is a text editor that can run in a command line interface. Find the line with /usr in the second column (ignoring any lines starting with #) and replace /usr with /home. Save the file (ctrl-x). Move the old /home directory to keep it as a backup for the time being
Code:
mv /home /home_old
mkdir /home
When you reboot and log in as ordinary user it should work If everything is OK you can delete the backups of /usr and /home
Code:
sudo rm -rf /home_old
sudo rm -rf /home/usr_old
sudo rmdir /media/temp
Does anyone see any details I missed?
Bookmarks