Nice n' Easy JQuery Image Rotator
Changing Mailman Python Scripts for Virtual Host Support
A Simple ISAPI Filter for Authentication on IIS
Using PHP pspell Spell Check Functions with a Custom Dictionary
Visualising Website Performance with Flame Graphs
Installing Xdebug for use with Eclipse or Netbeans on Linux

Move home Folder from its own Partition to the System Partition

Saturday, 29 November 08, 11:16 am
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 | sudo 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 in as the root user in this way, the system doesn't use the home directory, so you can then issue this command:
mv /newhome/home /home
Reboot, and the job is done. Note that you will still have the partition that used to be your home partition, containing the same home directories and their data as at the time of the switch. Merge this onto another partition if you want, using a tool such as the gparted live CD.

Please enter your comment in the box below. Comments will be moderated before going live. Thanks for your feedback!

Cancel Post

/xkcd/ Sandwich Helix