Move The Home Folder


The purpose of this page is to help migrate the users home folder to another disk, to help separate user files from the core Linux system.

There are a couple of methods for achieving this, the two I have looked are:

1. Change each users home directory field to new path
2. Physically move the /home folder to a new folder.
3. Physically move the /home folder to it's own partition.

I think each has it's own merits. In the end I opted to use method 2.

Method 1: Update user's home folder

Simply issue the command,

sudo usermod --home /mnt/data/home/demo demo

Where demo is the name of the user and /mnt/data/home/demo is the path to the new folder. In this case it is the another disk image mounted at /mnt/data. Please see Add a Disk Image for further information about this.

Method 2: Move the home folder to a new folder

This method physically moves the contents of the /home folder to a new location and creates a symbolic link to that to preserve the /home path.

Make a copy of the existing home folder in the new location, preserving permissions, links, etc.

sudo cp -a -d -p -r /home /mnt/data/

Rename the old home folder.

sudo mv /home /home_old

Make a symbolic link to the new home folder.

sudo ln -s /mnt/data/home /home

Once you are happy it is working you can remove the old home folder.

sudo rm -R /home_old

Method 3: Move the home folder to it's own partition

I have not yet documented this method. So pick method 1 or 2! ;-)

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License