How do I use my home directory on a separate partition?
My understanding of disc partitioning has always been that you partition a disc to install multiple operating systems so you can boot from multiple operating systems on a single disc. However I'm reading a ubuntu server book and it talks about partitioning the /home directory of a ubuntu installation.
"The /home directory is a popular partitioning candidate among both administrators and desktop users alike because it holds all of the personal files for user accounts on that machine. If you maintain /home as a separate partition, you can install new versions of a distribution or even different distributions altogether without wiping out any user settings."
I don't see how and why anyone would partition the home directory or any other directory for that matter in the file system of a ubuntu installation.
When installing Ubuntu to a hard drive the installer takes care of partitioning. In case it finds an empty unpartitioned space it will use this for your Ubuntu Installation. If you had already installed an OS the Installer will let you shrink a partition to then hold Ubunutu.
By default a single partition, and an additional swap partition will be created. In case the installer finds a pre-existing swap partition it will not create an additional one. We may want to hold our HOME in a separate partition, be it to
- mirror this partition
- easy format the OS partition without deleting HOME
- having the OS on a fast SSD but HOME on a conventional drive,
- or a variety of other reasons.
Note that it is not a good idea to share all of the HOME partition with different distributions or releases as this may lead to conflicting configuration settings from differing application versions. Rather than sharing all of HOME we should share data on a shared partition only. These data directories can then be symlinked to from the user's home subdirectories.
In the following sections let me depict procedures for having HOME on a partition or a drive different to the OS:
Backup all of your important data before you change partitions.
Desktop installation
- On installing Ubuntu choose "Something else" to have access to the partitioner.
- If the drive was used before, remove the partition table or delete partitions to hold your Ubuntu. All data on these partitions will be deleted.
- Create a new partition to hold the OS root directory.
-
Choose the mount point
/
for this root partition:Note the different mount points you may be able to choose for any partition created.
-
Repeat step 3. and 4. for the
/home
partition:In case there is a pre-existing HOME partition holding data we now have to make sure to untick "Format?" before we proceed with the installation to not delete this data:
Choose "Install now" to partition and format the drive and proceed with the installation.
Ubuntu Server installation
The server installation will guide you through the partitioning using partman. At the partitioning step we may delete, or create new partitions similar to the desktop installation. Shown below are interim steps when we do so:
-
Choose "Manual" partitioning for an individual setup:
-
Choose partition to change or free space to create a partition
-
Select mount points
/
for root or/home
for HOME: -
Repeat steps 2. to 4. until finished:
-
Continue server installation:
Move exisiting HOME to a different location
See question and answers below on procdeures to move the HOME directory to a different partition or drive:
- Move home folder to second drive
You quoted the answer to your own question...
If you maintain /home as a separate partition, you can install new versions of a distribution or even different distributions altogether without wiping out any user settings.
A partition is just a way to separate the files in the hard drive, it doesn't need to be a place for an operating system. If your system partition and your home partition are separated, if you upgrade your system it'll only affect the system partition, leaving your data alone.
There are other uses for a different data partition such as encrypting it or a having a different filesystem than the operating system's one.
Note that Linux treats /home, /usr, /var... as folders, even if they are separate partitions (they are mounted at bootup). So having a separate /home partition won't affect you in any negative way, go ahead and do it.
If you intend to have a server someday, I'd advise to use a separate /var partition, and probably a separate /usr and /tmp too.