Chapter 9. Managing Files and Partitions


Understanding filesystem fundamentals is key to understanding how Linux works. Everything is a file—data files, partitions, pipes, sockets, and hardware devices. Directories are simply files that list other files.

The Filesystem Hierarchy Standard (FHS) was developed as a voluntary standard. Most Linuxes follow it. These are the required elements of the Linux root filesystem:


Root directory, even though it is always represented at the top


Essential system commands


Static boot loader files


Device files


Host-specific system configuration files


Shared libraries needed to run the local system


Temporary mount points


Add-on software packages (not used much in Linux)


Live kernel snapshot and configuration


System administration commands


Temporary files—a well-behaved system flushes them between startups


Shareable, read-only data and binaries


Variably sized files, such as mail spools and logs

These are considered optional because they can be located anywhere on a network, whereas the required directories must be present to run the machine:


User’s personal files


Superuser’s personal files

The FHS goes into great detail on each directory, for those who are interested. Here are some things for the Linux user to keep in mind:

  • /tmp and /var can go in their own individual partitions, as a security measure. If something goes awry and causes them to fill up uncontrollably, they will be isolated from ...

Get Linux Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.