Linux Filesystem Layout
The contents of this page have primarily been adapted from the Filesystem Hierarchy Standard. It briefly summarizes key concepts and material that is necessary to understand when administrating Linux systems which fully (or even partially) adhere to the FHS standard.
Partitioning
The FHS recommends that the root partition be kept as small as possible in order to:
- Allow mounting it from small media
- Separating specific system files (i.e. kernel) from more sharable files
- To not assume that other individuals have large root partitions
- To reduce the surface area of disk errors impacting the root partition
Structure
The follow directories (or symlinks) are required:
Directory | Description | Link |
---|---|---|
bin | Essential command binaries | Link |
boot | Static files of the boot loader | Link |
dev | Device files | Link |
etc | Host-specific system configuration | Link |
lib | Essential shared libraries and kernel modules | Link |
media | Mount point for removable media | Link |
mnt | Mount point for mounting a filesystem temporarily | Link |
opt | Add-on application software packages | Link |
run | Data relevant to running processes | Link |
sbin | Essential system binaries | Link |
srv | Data for services provided by the system | Link |
tmp | Temporary files | Link |
usr | Secondary hierachy | Link |
var | Variable data | Link |
The following directories (or symlinks) are optional:
Directory | Description | Link |
---|---|---|
home | User home directories | Link |
root | Home directory for the root user | Link |
In particular, there's a growing convention for using the XDG Base Directory
Specification for creating the home
directory layout. See the specification
here.