Spooky Case of the Wem Ghost
Installing Proprietary nVidia Drivers on Ubuntu Linux
Reading Email with PHP and IMAP/POP3
Garmin Edge 205 GPS Cycle Training Tool
Nasa's Space Shuttle Atlantis Transiting the Sun
Javascript Snippets

Move home Folder from its own Partition to the System Partition

Sat 29 Nov 2008
4:16AM
compton
There's a lot of articles on the web explaining how to move a Linux home folder (containing all the user accounts) from the system partition onto its own partition.

I wanted to do the reverse procedure, and move my separate home partition to a regular home folder on the system partition. The only problem is that home can contain a variety of files and symlinks that wouldn't all get copied correctly with the mv command. The cpio archiving utility, available on a default Linux install, is able to handle it correctly:

sudo mkdir /newhome
find /home -depth -print0 | cpio --null --sparse -pvd /newhome/


This creates a duplicate of our home directory on the system partition, in the folder called /newhome. The next stage of the switch is to stop mounting the current partition as /home. Find the relevant line in /etc/fstab and either edit it so the partition is mounted elsewhere or just comment it out.

At this point I rebooted using the 'recovery console' option from the grub boot menu. When logged as the root user in this way the system doesn't use the home directory, and you can then issue this command:

mv /newhome/ /home

Reboot, and the job is done.
 
Leave Comment