Initial release 14 February 1994; 23 years ago (1994-02-14) Latest release 3.0(3 June 2015; 20 months ago (2015-06-03)) Website Official websiteOfficial website (Historical) |
The Filesystem Hierarchy Standard (FHS) defines the directory structure and directory contents in Unix-like operating systems. It is maintained by the Linux Foundation. The latest version is 3.0, released on 3 June 2015. Currently it is only used by Linux distributions.
Contents
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 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.
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 that generally follow the standard deviate from it in some areas. Common deviations include:
/sys
directory as a virtual filesystem (sysfs, comparable to /proc
, which is a procfs), which stores and allows modification of the devices connected to the system, whereas many traditional UNIX and Unix-like operating systems use /sys
as a symbolic link to the kernel source tree./usr/local
while keeping code considered part of the operating system in /usr
./lib
versus /usr/lib
and have /lib
symlinked to /usr/lib
./bin
versus /usr/bin
and /sbin
versus /usr/sbin
. They symlink /bin
to /usr/bin
and /sbin
to /usr/sbin
. And /usr/sbin
may get symlinked to /usr/bin
.Modern Linux distributions include a /run
directory as a temporary filesystem (tmpfs) 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/*
(writeable files) → /run/*
/lib/init/rw
→ /run
/var/lock
→ /run/lock
/var/run
→ /run
/tmp
→ /run/tmp
History
When the FHS was created as the FSSTND (short for "Filesystem Standard"), other UNIX and Unix-like operating systems already had their own standards. Notable examples are these: the hier(7) description of file system layout, which has existed since the release of Version 7 Unix (in 1979); the SunOS filesystem(7) and its successor, the Solaris filesystem(5).