Filesystem Hierarchy Standard - Version 2.1: Edited by Daniel Quinlan
Filesystem Hierarchy Standard - Version 2.1: Edited by Daniel Quinlan
Filesystem Hierarchy Standard - Version 2.1: Edited by Daniel Quinlan
ABSTRACT
This standard consists of a set of requirements and guidelines for file and directory
placement under UNIX-like operating systems. The guidelines are intended to support
interoperability of applications, system administration tools, development tools, and scripts as
well as greater uniformity of documentation for these systems.
All trademarks and copyrights are owned by their owners, unless specifically noted otherwise. Use of a
term in this document should not be regarded as affecting the validity of any trademark or service mark.
-2-
Filesystem Hierarchy Standard April 12, 2000
1. Introduction
1.3 Conventions
A constant-width font is used for displaying the names of files and directories.
Components of filenames that vary are represented by a description of the contents enclosed in "<" and ">"
characters, <thus>. Electronic mail addresses are also enclosed in "<" and ">" but are shown in the usual
typeface.
Optional components of filenames are enclosed in "[" and "]" characters and may be combined with the
"<" and ">" convention. For example, if a filename is allowed to occur either with or without an extension,
it might be represented by <filename>[.<extension>].
Variable substrings of directory names and filenames are indicated by "*".
-3-
Filesystem Hierarchy Standard April 12, 2000
Volunteers who have contributed extensively to this standard are listed at the end of this document. This
standard represents a consensus view of those and other contributors.
1.5 Scope
This document specifies a standard filesystem hierarchy for FHS filesystems by specifying the location of
files and directories, and the contents of some system files.
This standard has been designed to be used by system integrators, package developers, and system
administrators in the construction and maintenance of FHS compliant filesystems. It is primarily intended
to be a reference and is not a tutorial on how to manage a conforming filesystem hierarchy.
The FHS grew out of earlier work on FSSTND, a filesystem organization standard for the Linux operating
system. It builds on FSSTND to address interoperability issues not just in the Linux community but in a
wider arena including 4.4BSD-based operating systems. It incorporates lessons learned in the BSD world
and elsewhere about multi-architecture support and the demands of heterogeneous networking.
Although this standard is more comprehensive than previous attempts at filesystem hierarchy
standardization, periodic updates may become necessary as requirements change in relation to emerging
technology. It is also possible that better solutions to the problems addressed here will be discovered so
that our solutions will no longer be the best possible solutions. Supplementary drafts may be released in
addition to periodic updates to this document. However, a specific goal is backwards compatibility from
one release of this document to the next.
Comments related to this standard are welcome. Any comments or suggestions for changes should be
directed to the FHS editor (Daniel Quinlan <[email protected]>), or if you prefer, the FHS mailing
list. Typographical or grammatical comments should be directed to the FHS editor.
Before sending mail to the mailing list it is requested that you first contact the FHS editor in order to avoid
excessive re-discussion of old topics. Improper messages will not be well-received on the mailing list.
Questions about how to interpret items in this document may occasionally arise. If you have need for a
clarification, please contact the FHS editor. Since this standard represents a consensus of many
participants, it is important to make certain that any interpretation also represents their collective opinion.
For this reason it may not be possible to provide an immediate response unless the inquiry has been the
subject of previous discussion.
-4-
Filesystem Hierarchy Standard April 12, 2000
-5-
Filesystem Hierarchy Standard April 12, 2000
2. The Filesystem
The UNIX filesystem is characterized by:
• A hierarchical structure
• Consistent treatment of file data
• Protection of file data
This standard assumes that the operating system underlying an FHS-compliant file system supports the
same basic security features found in most UNIX filesystems. Note that this standard does not attempt to
agree in every possible respect with any particular UNIX system’s implementation. However, many aspects
of this standard are based on ideas found in UNIX and other UNIX-like systems.
This is after careful consideration of other factors, including:
• Traditional and well-considered practices in UNIX-like systems.
• The implementation of other filesystem structures
• Applicable standards
It is possible to define two independent categories of files: shareable vs. unshareable and variable vs. static.
Shareable data is that which can be shared between several different hosts; unshareable is that which must
be specific to a particular host. For example, user home directories are shareable data, but device lock files
are not.
Static data includes binaries, libraries, documentation, and anything that does not change without system
administrator intervention; variable data is anything else that does change without system administrator
intervention.
For ease of backup, administration, and file-sharing on heterogenous networks of systems with different
architectures and operating systems, it is desirable that there be a simple and easily understandable
mapping from directories (especially directories considered as potential mount points) to the type of data
they contain.
Throughout this document, and in any well-planned filesystem, an understanding of this basic principle will
help organize the structure and lend it additional consistency.
The distinction between shareable and unshareable data is needed for several reasons:
• In a networked environment (i.e., more than one host at a site), there is a good deal of data that can be
shared between different hosts to save space and ease the task of maintenance.
• In a networked environment, certain files contain information specific to a single host. Therefore
these filesystems cannot be shared (without taking special measures).
• Historical implementations of UNIX-like filesystems interspersed shareable and unshareable data in
the same hierarchy, making it difficult to share large portions of the filesystem.
The "shareable" distinction can be used to support, for example:
• A /usr partition (or components of /usr) mounted (read-only) through the network (using NFS).
• A /usr partition (or components of /usr) mounted from read-only media. A CD-ROM is one
copy of many identical ones distributed to other users by the postal mail system and other methods.
It can thus be regarded as a read-only filesystem shared with other FHS-compliant systems by some
kind of "network".
The "static" versus "variable" distinction affects the filesystem in two major ways:
-6-
Filesystem Hierarchy Standard April 12, 2000
• Since / contains both variable and static data, it needs to be mounted read-write.
• Since the traditional /usr contains both variable and static data, and since we may want to mount it
read-only (see above), it is necessary to provide a method to have /usr mounted read-only. This is
done through the creation of a /var hierarchy that is mounted read-write (or is a part of another
read-write partition, such as /), taking over much of the /usr partition’s traditional functionality.
Here is a summarizing chart. This chart is only an example for a common FHS-compliant system, other
chart layouts are possible within FHS-compliance.
shareable unshareable
static /usr /etc
/opt /boot
variable /var/mail /var/run
/var/spool/news /var/lock
-7-
Filesystem Hierarchy Standard April 12, 2000
BEGIN RATIONALE
There are several reasons why introducing a new subdirectory of the root filesystem is prohibited:
• It demands space on a root partition which the system administrator may want kept small and simple
for either performance or security reasons.
• It evades whatever discipline the system administrator may have set up for distributing standard file
hierarchies across mountable volumes.
END RATIONALE
-8-
Filesystem Hierarchy Standard April 12, 2000
3.1 /bin : Essential user command binaries (for use by all users)
/bin contains commands that may be used by both the system administrator and by users, but which are
required when no other filesystems are mounted (e.g. in single user mode). It may also contain commands
which are used indirectly by scripts.
There should be no subdirectories within /bin.
Command binaries that are not essential enough to place into /bin should be placed in /usr/bin,
instead. Items that are required only by non-root users (the X Window System, chsh, etc.) are generally
not essential enough to be placed into the root partition.
-9-
Filesystem Hierarchy Standard April 12, 2000
/usr/bin. They must be included as separate binaries with any UNIX or UNIX-like system
attempting to comply with the POSIX.2 standard.
• Restoration commands:
- 10 -
Filesystem Hierarchy Standard April 12, 2000
- 11 -
Filesystem Hierarchy Standard April 12, 2000
BEGIN RATIONALE
Refer to the rationale for /opt.
END RATIONALE
- 12 -
Filesystem Hierarchy Standard April 12, 2000
BEGIN RATIONALE
The use of /opt for add-on software is a well-established practice in the UNIX community. The System
V Application Binary Interface [AT&T 1990], based on the System V Interface Definition (Third Edition),
provides for an /opt structure very similar to the one defined here.
The Intel Binary Compatibility Standard v. 2 (iBCS2) also provides a similar structure for /opt.
Generally, all data required to support a package on a system should be present within
/opt/<package>, including files intended to be copied into /etc/opt/<package> and
/var/opt/<package> as well as reserved directories in /opt.
The minor restrictions on distributions using /opt are necessary because conflicts are possible between
distribution-installed and locally-installed software, especially in the case of fixed pathnames found in some
binary software.
END RATIONALE
- 13 -
Filesystem Hierarchy Standard April 12, 2000
- 14 -
Filesystem Hierarchy Standard April 12, 2000
BEGIN RATIONALE
IEEE standard P1003.2 (POSIX, part 2) makes requirements that are similar to the above section.
FHS added the recommendation that /tmp be cleaned at boot time on the basis of historical precedent and
common practice, but did not make it a requirement because system administration is not within the scope
of this standard.
END RATIONALE
- 15 -
Filesystem Hierarchy Standard April 12, 2000
- 16 -
Filesystem Hierarchy Standard April 12, 2000
- 17 -
Filesystem Hierarchy Standard April 12, 2000
- 18 -
Filesystem Hierarchy Standard April 12, 2000
Any program or package which contains or requires data that doesn’t need to be modified should store that
data in /usr/share (or /usr/local/share, if installed locally). It is recommended that a
subdirectory be used in /usr/share for this purpose.
Note that Linux currently uses DBM-format database files. While these are not architecture-independent,
they are allowed in /usr/share in anticipation of a switch to the architecture-independent DB 2.0
format.
Game data stored in /usr/share/games should be purely static data. Any modifiable files, such as
score files, game play logs, and so forth, should be placed in /var/games.
It is recommended that application-specific, architecture-independent directories be placed here. Such
directories include groff, perl, ghostscript, texmf, and kbd (Linux) or syscons (BSD). They
may, however, be placed in /usr/lib for backwards compatibility, at the distributor’s discretion.
Similarly, a /usr/lib/games hierarchy may be used in addition to the /usr/share/games
hierarchy if the distributor wishes to place some game data there.
BEGIN RATIONALE
The reason that only word lists are located here is that they are the only files common to all spell checkers.
END RATIONALE
- 19 -
Filesystem Hierarchy Standard April 12, 2000
1. A major exception to this rule is the United Kingdom, which is ‘GB’ in the ISO 3166, but ‘UK’ for most email addresses.
- 20 -
Filesystem Hierarchy Standard April 12, 2000
- 21 -
Filesystem Hierarchy Standard April 12, 2000
- 22 -
Filesystem Hierarchy Standard April 12, 2000
- 23 -
Filesystem Hierarchy Standard April 12, 2000
BEGIN RATIONALE
The existence of a separate directory for cached data allows system administrators to set different disk and
backup policies from other directories in /var.
END RATIONALE
- 24 -
Filesystem Hierarchy Standard April 12, 2000
BEGIN RATIONALE
Release 1.2 of the standard specified /var/catman for this hierarchy. The path has been moved under
/var/cache to better reflect the dynamic nature of the formatted man pages. The directory name has
been changed to man to allow for enhancing the hierarchy to include post-processed formats other than
"cat", such as PostScript, HTML, or DVI.
END RATIONALE
BEGIN RATIONALE
/var/games has been given a hierarchy of its own, rather than leaving it merged in with the old
/var/lib as in release 1.2. The separation allows local control of backup strategies, permissions, and
disk usage, as well as allowing inter-host sharing and reducing clutter in /var/lib. Additionally,
/var/games is the path traditionally used by BSD.
END RATIONALE
- 25 -
Filesystem Hierarchy Standard April 12, 2000
BEGIN RATIONALE
Previous Linux releases, as well as all commercial vendors, use /var/preserve for vi or its clones.
However, each editor uses its own format for these crash-recovery files, so a separate directory is needed for
each editor.
Editor-specific lock files are usually quite different from the device or resource lock files that are stored in
/var/lock and, hence, are stored under /var/lib.
END RATIONALE
- 26 -
Filesystem Hierarchy Standard April 12, 2000
The format used for device lock files must be the HDB UUCP lock file format. The HDB format is to store
the process identifier (PID) as a ten byte ASCII decimal number, with a trailing newline. For example, if
process 1230 holds a lock file, it would contain the eleven characters: space, space, space, space, space,
space, one, two, three, zero, and newline.
Then, anything wishing to use /dev/cua0 can read the lock file and act accordingly (all locks in
/var/lock should be world-readable).
BEGIN RATIONALE
The logical location for this directory was changed from /var/spool/mail in order to bring FHS in-
line with nearly every UNIX implementation. This change is important for inter-operability since a single
/var/mail is often shared between multiple hosts and multiple UNIX implementations (despite NFS
locking issues).
It is important to note that there is no requirement to physically move the mail spool to this location.
However, programs and header files should be changed to use /var/mail.
END RATIONALE
BEGIN RATIONALE
Refer to the rationale for /opt.
END RATIONALE
- 27 -
Filesystem Hierarchy Standard April 12, 2000
BEGIN RATIONALE
Some BSD releases use /var/rwho for this data; given its historical location in /var/spool on other
systems and its approximate fit to the definition of ‘spooled’ data, this location was deemed more
appropriate.
END RATIONALE
- 28 -
Filesystem Hierarchy Standard April 12, 2000
BEGIN RATIONALE
/var/yp is the standard directory for NIS (YP) data and is almost exclusively used in NIS documentation
and systems.
NIS should not be confused with Sun NIS+, which uses a different directory, /var/nis.
END RATIONALE
- 29 -
Filesystem Hierarchy Standard April 12, 2000
6.1 Linux
This is the annex for the Linux operating system.
BEGIN RATIONALE
The requirement not to make symlinks promiscuously is made because local setups will often differ from
that on the distributor’s development machine. Also, if a distribution install script configures the symbolic
links at install time, these symlinks will often not get updated if local changes are made in hardware. When
used responsibly at a local level, however, they can be put to good use.
END RATIONALE
- 30 -
Filesystem Hierarchy Standard April 12, 2000
concern now that the ldconfig program (usually located in /usr/sbin) exists and can act as a
guiding hand in upgrading the dynamic libraries. Static sync is useful in some emergency
situations. Note that these need not be statically linked versions of the standard ln and sync, but
may be.
The ldconfig binary is optional for /sbin since a site may choose to run ldconfig at boot
time, rather than only when upgrading the shared libraries. (It’s not clear whether or not it is
advantageous to run ldconfig on each boot.) Even so, some people like ldconfig around for
the following (all too common) situation:
(1) I’ve just removed /lib/<file>.
(2) I can’t find out the name of the library because ls is dynamically linked, I’m using a shell
that doesn’t have ls built-in, and I don’t know about using "echo *" as a replacement.
(3) I have a static sln, but I don’t know what to call the link.
• Miscellaneous:
{ ctrlaltdel, kbdrate }
So as to cope with the fact that some keyboards come up with such a high repeat rate as to be
unusable, kbdrate may be installed in /sbin on some systems.
Since the default action in the kernel for the Ctrl-Alt-Del key combination is an instant hard reboot, it
is generally advisable to disable the behavior before mounting the root filesystem in read-write mode.
Some init suites are able to disable Ctrl-Alt-Del, but others may require the ctrlaltdel
program, which may be installed in /sbin on those systems.
BEGIN RATIONALE
It is important that the kernel include files be located in /usr/src/linux and not in /usr/include
so there are no problems when system administrators upgrade their kernel version for the first time.
- 31 -
Filesystem Hierarchy Standard April 12, 2000
END RATIONALE
- 32 -
Filesystem Hierarchy Standard April 12, 2000
7. Appendix
7.2 Acknowledgments
The developers of the FHS wish to thank the developers, system administrators, and users whose input was
essential to this standard. We wish to thank each of the contributors who helped to write, compile, and
compose this standard.
The FHS Group also wishes to thank those Linux developers who supported the FSSTND, the predecessor
to this standard. If they hadn’t demonstrated that the FSSTND was beneficial, the FHS could never have
evolved.
7.3 Contributors
- 33 -
CONTENTS
1. Introduction .......................................................................................................................................... 2
1.1 Status of the Standard ................................................................................................................. 2
1.2 Organization of the Standard ...................................................................................................... 2
1.3 Conventions ................................................................................................................................ 2
1.4 Background of the FHS .............................................................................................................. 2
1.5 Scope ........................................................................................................................................... 3
1.6 General Guidelines ..................................................................................................................... 3
1.7 Intended Audience ...................................................................................................................... 3
1.8 Conformance with this Document .............................................................................................. 4
2. The Filesystem ..................................................................................................................................... 5
3. The Root Directory .............................................................................................................................. 7
3.1 /bin : Essential user command binaries (for use by all users) ..................................................... 8
3.2 /boot : Static files of the boot loader ........................................................................................... 9
3.3 /dev : Device files ........................................................................................................................ 9
3.4 /etc : Host-specific system configuration .................................................................................. 10
3.5 /home : User home directories (optional) ................................................................................. 11
3.6 /lib : Essential shared libraries and kernel modules .................................................................. 11
3.7 /mnt : Mount point for temporarily mounted filesystems ......................................................... 11
3.8 /opt : Add-on application software packages ............................................................................ 12
3.9 /root : Home directory for the root user (optional) ................................................................... 12
3.10 /sbin : System binaries (binaries once kept in /etc) .................................................................. 13
3.11 /tmp : Temporary files ............................................................................................................... 13
4. The /usr Hierarchy ............................................................................................................................. 15
4.1 /usr/X11R6 : X Window System, Version 11 Release 6 ........................................................... 15
4.2 /usr/bin : Most user commands ................................................................................................. 15
4.3 /usr/include : Directory for standard include files. ................................................................... 16
4.4 /usr/lib : Libraries for programming and packages ................................................................... 16
4.5 /usr/local : Local hierarchy ....................................................................................................... 16
4.6 /usr/sbin : Non-essential standard system binaries ................................................................... 17
4.7 /usr/share : Architecture-independent data ............................................................................... 17
4.8 /usr/src : Source code ................................................................................................................ 21
5. The /var Hierarchy ............................................................................................................................. 22
5.1 /var/account : Process accounting logs (if supported) .............................................................. 22
5.2 /var/cache : Application cache data .......................................................................................... 23
5.3 /var/crash : System crash dumps (if supported) ........................................................................ 24
5.4 /var/games : Variable game data ............................................................................................... 24
5.5 /var/lib : Variable state information .......................................................................................... 24
5.6 /var/lock : Lock files ................................................................................................................. 25
5.7 /var/log : Log files and directories ............................................................................................ 26
5.8 /var/mail : User mailbox files .................................................................................................... 26
5.9 /var/opt : Variable data for /opt ................................................................................................. 26
5.10 /var/run : Run-time variable data .............................................................................................. 26
5.11 /var/spool : Application spool data ........................................................................................... 27
5.12 /var/tmp : Temporary files preserved between system reboots ................................................. 28
i
5.13 /var/yp : Network Information Service (NIS) database files .................................................... 28
6. Operating System Specific Annex ..................................................................................................... 29
6.1 Linux ......................................................................................................................................... 29
7. Appendix ............................................................................................................................................ 32
7.1 The FHS mailing list ................................................................................................................. 32
7.2 Acknowledgments .................................................................................................................... 32
7.3 Contributors .............................................................................................................................. 32
ii