Filesystem Hierarchy Standard


The Filesystem Hierarchy Standard defines the directory structure and directory contents in Linux distributions. It is maintained by the Linux Foundation. The latest version is 3.0, released on 3 June 2015.

Directory structure

In the FHS, all files and directories appear under the root directory /, even if they are stored on different physical or virtual devices. Some of these directories only exist on a particular system if certain subsystems, such as the X Window System, are installed.
Most of these directories exist in all Unix-like operating systems and are generally used in much the same way; however, the descriptions here are those used specifically for the FHS, and are not considered authoritative for platforms other than Linux.
DirectoryDescription

There has been controversy over the meaning of the name itself. In early versions of the UNIX Implementation Document from Bell labs, /etc is referred to as the etcetera directory, as this directory historically held everything that did not belong elsewhere. Since the publication of early documentation, the directory name has been re-explained in various ways. Recent interpretations include backronyms such as "Editable Text Configuration" or "Extended Tool Chest".

In FHS 3.0, /var/run is replaced by /run; a system should either continue to provide a /var/run directory, or provide a symbolic link from /var/run to /run, for backwards compatibility.

FHS compliance

Most Linux distributions follow the Filesystem Hierarchy Standard and declare it their own policy to maintain FHS compliance. GoboLinux and NixOS provide examples of intentionally non-compliant filesystem implementations.
Some distributions generally follow the standard but deviate from it in some areas. The FHS is a 'trailing standard', and so documents common practices at a point in time. Times of course change, and distribution goals and needs call for experimentation. Some common deviations include:
  • Modern Linux distributions include a /sys directory as a virtual filesystem, which stores and allows modification of the devices connected to the system, whereas many traditional Unix-like operating systems use /sys as a symbolic link to the kernel source tree.
  • Many modern Unix-like systems install third party packages into /usr/local while keeping code considered part of the operating system in /usr.
  • Some Linux distributions no longer differentiate between /lib versus /usr/lib and have /lib symlinked to /usr/lib.
  • Some Linux distributions no longer differentiate between /bin versus /usr/bin and /sbin versus /usr/sbin. They may symlink /bin to /usr/bin and /sbin to /usr/sbin. Other distributions choose to consolidate all four, symlinking them to /usr/bin.
Modern Linux distributions include a /run directory as a temporary filesystem which stores volatile runtime data, following the FHS version 3.0. According to the FHS version 2.3, such data were stored in /var/run but this was a problem in some cases because this directory is not always available at early boot. As a result, these programs have had to resort to trickery, such as using /dev/.udev, /dev/.mdadm, /dev/.systemd or /dev/.mount directories, even though the device directory isn't intended for such data. Among other advantages, this makes the system easier to use normally with the root filesystem mounted read-only.
For example, below are the changes Debian made in its 2013 Wheezy release:
  • /dev/.*/run/*
  • /dev/shm/run/shm
  • /dev/shm/*/run/*
  • /etc/*/run/*
  • /lib/init/rw/run
  • /var/lock/run/lock
  • /var/run/run
  • /tmp/run/tmp

    History

FHS was created as the FSSTND, largely based on similar standards for other Unix-like operating systems. Notable examples are these: the description of file system layout, which has existed since the release of Version 7 Unix ; the SunOS and its successor, the Solaris.

Release history

OWIKI.org. Text is available under the Creative Commons Attribution-ShareAlike License.