Should /usr and /home be on different partitions?
The 3 primary reasons you would create these as separate partitions are as follows:
- performance
- isolation
- security
Examples
By separating
/home
you can put this data on a shared network disk so that when UserA logs into servers in a given domain, their/home/$USER
will be a single copy that follows them from machine to machine. This is typically done using NFS and automounts (aka.autofs
).By putting
/usr
data on it's own partition, it can be mounted read-only, offering a level of protection to the data under this directory so that it cannot be tampered with so easily.Some additional reasoning for isolating
/usr
, is for making it easier to deploy identical systems, these partitions can be prepared one time and then replicated across systems more easily.Also separating the data out can make it easier for backup cycles.
Finally separating volatile directories such as
/home
can protect a system from having it's primary disk fill up by either an accidental or malicious user.
Over the course of my 15+ years of doing this I've only ever seen /home
separated (as a network share via NFS) and the /boot
and /var
directories as being isolated as separate partitions. Outside of some esoteric Solaris boxes I can't recall ever seeing a Linux system having a separate /usr
- and note that if you don't have /usr
mounted before init
starts, your system will break in esoteric and silent ways.
Putting /home
on a separate partition is fairly common. That typically splits system files (/
) and user files (/home
). The two filesystems may have different performance trade-offs, different backup policies, different quotas, different security policies, etc. Also this way the OS can be reinstalled or reimaged independently of the user data. Splitting /home
is a good idea both for single-user workstations and for multi-user systems that store user files. I'd only keep /home
on the same partition on a server that has no user files beyond the administrators' configuration files (but there might be a separate partition for whatever that machine is about — /var/mail
, or a database, etc.), or on a quick-and-simple installation especially on a laptop which isn't going to be rebalanced to use a second disk.
Putting /usr
on a separate partition used to be common, back when the OS used a large amount of disk space (say, 300MB out of 1GB). This partition could be made read-only, might be shared over the network. Making /usr
read-only had the advantage that in case of a power loss, it wouldn't need an fsck. Nowadays all major filesystems use a journal and don't require any lengthy fsck, and disk sizes have increased a lot more than OS sizes — 30GB out of 1TB is peanuts, so it doesn't need to be shared. There is no good reason to split /usr
from the rest of the system (/bin
, /etc
, /var
, …). If you see advice to split /usr
, it's grossly obsolete.
It is common to separate /usr
and /home
. There are a number of
reasons for this. Here are a few:
Encryption
Although encrypting the contents of /usr
can have some benefits, it is common
to dedicate full encrypted partitions to /home
directories and leave /usr
unencrypted.
Different drives
I am currently using a laptop that has a small SSD and a large hard drive. The
root partition, which includes /usr
, is on the SSD. /home
is on the hard
drive. SSDs wear down relatively quickly as they are written to. Putting
volatile directories such as /home
and /var
on the SSD would decrease its
lifespan significantly. Putting my root partition on the SSD decreases my
machine's boot time.
Security
It is common to mount /home
directories with the nosetuid
option. This
option disallows the execution of setuid files on a mount. Setting this option
makes it more difficult for users to hide away root-owned setuid shells.