Jump to content

Filesystem Hierarchy Standard

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by 2806:250:914:c1ec:f04b:ba09:4b35:b403 (talk) at 05:56, 20 March 2024. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.


The Filesystem Hierarchy Standard is a reference describing the conventions used for the layout of Unix-like systems. It has been made popular by its use in Linux distributions, but it is used by other Unix-like systems as well. It is maintained by the Linux Foundation. The late version is 3.0, release off 3 June 2015.

Director struct

In the FHS, all files and directories appear under the root dir

ectory /, even if they are stored on different physical or virtual devices. Some of these directories only exist in 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.

FHS compliance

Most Linux distributions follow the Filesystem Hierarchy Standard and declare it their own policy to maintain FHS compliance.[1][2][3][4] GoboLinux[5] and NixOS[6] 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. Of course, times change, and distribution goals and needs call for experimentation. Some common deviations include:

  • Modern Linux distributions include a /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,[7] whereas many traditional Unix-like operating systems use /sys as a symbolic link to the kernel source tree.[8]
  • Many modern Unix-like systems (like FreeBSD via its ports system) 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 and /usr/lib and have /lib symlinked to /usr/lib.[9]
  • Some Linux distributions no longer differentiate between /bin and /usr/bin and between /sbin and /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.[10]

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 is not intended for such data.[11] 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:[12]

  • /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

The name of usr

/usr originally stood for "user".[13] This was an artifact of early Unix programming. Specifically, when Ken Thompson and Dennis Ritchie were migrating Unix to a PDP-11, the /bin, /lib... directories, which were to be the first directories to be mounted on startup, and must contain all essentials for the OS to function, became bigger than the RK05 disk drive. So they put some of those in the first RK05, including those that are required for loading the second RK05 drive. The rest were put into the /usr directory.[14] When they got a third drive, users' files were moved to a new directory named /home.[15]

FHS was created as the FSSTND (short for "Filesystem Standard"[16]), largely based on similar standards for other Unix-like operating systems. Notable examples are these: the hier(7) description of file system layout,[17] which has existed since the release of Version 7 Unix (in 1979);[18] the SunOS filesystem(7)[19] and its successor, the Solaris filesystem(7).[20][21]

Release history

Version Release date Notes
Old version, not maintained: 1.0 1994-02-14 FSSTND[22]
Old version, not maintained: 1.1 1994-10-09 FSSTND[23]
Old version, not maintained: 1.2 1995-03-28 FSSTND[24]
Old version, not maintained: 2.0 1997-10-26 FHS 2.0 is the direct successor for FSSTND 1.2. Name of the standard was changed to Filesystem Hierarchy Standard.[25][26][27]
Old version, not maintained: 2.1 2000-04-12 FHS[28][29][30]
Old version, not maintained: 2.2 2001-05-23 FHS[31]
Old version, not maintained: 2.3 2004-01-29 FHS[32]
Latest version: 3.0 2015-05-18 FHS[33]
Legend:
Old version
Latest version

See also

Notes

Referenc

  1. ^ Red Hat reference guide on file system structure.
  2. ^ SuSE Linux Enterprise Server Administration, Novell authorized courseware, by Jason W. Eckert, Novell; Course Technology, 2006; ISBN 1-4188-3731-8, ISBN 978-1-4188-3731-0.
  3. ^ Debian policy on FHS compliance.
  4. ^ Ubuntu Linux File system Tree Overview – Community Ubuntu Documentation.
  5. ^ Hisham Muhammad (9 May 2003). "The Unix tree rethought: an introduction to GoboLinux". Retrieved 2016-10-04.
  6. ^ Dolstra, E.; Löh, A. (September 2008). NixOS: A Purely Functional Linux Distribution (PDF). ICFP 2008: 13th ACM SIGPLAN International Conference on Functional Programming. Victoria, British Columbia, Canada. pp. 367–378.
  7. ^ "5.3 About the /sys Virtual File System". docs.oracle.com. Oracle. Archived from the original on 8 July 2016. Retrieved 8 July 2016.
  8. ^ Lehey, Greg (May 2003). The Complete FreeBSD: Documentation from the Source (Fourth ed.). O'Reilly Media, Incorporated. pp. 188, 609. ISBN 9780596005160.
  9. ^ Allan McRae. "Arch Linux – News: The /lib directory becomes a symlink". archlinux.org. Archived from the original on 9 September 2014. Retrieved 14 December 2019.
  10. ^ Allan McRae. "Arch Linux – News: Binaries move to /usr/bin requiring update intervention". archlinux.org. Archived from the original on 10 September 2014. Retrieved 15 December 2019.
  11. ^ Lennart Poettering (30 March 2011). "What's this /run directory doing on my system and where does it come from?". devel@lists.fedoraproject.org (Mailing list).
  12. ^ "ReleaseGoalsRunDirectory". Debian Wiki.
  13. ^ "/usr". tldp.org. Retrieved 2023-12-10.
  14. ^ M. D. McIlroy (1987). "A Research Unix reader: annotated excerpts from the Programmer's Manual, 1971–1986" (PDF). Bell Labs. CSTR 139.
  15. ^ Landley, Rob (December 9, 2010). "Understanding the bin, sbin, usr/bin , usr/sbin split". busybox (Mailing list).
  16. ^ "FSSTND FAQ page". Retrieved 2016-05-10.
  17. ^ hier(7) – FreeBSD Miscellaneous Information Manual.
  18. ^ hier(7) – Version 7 Unix Programmer's Manual
  19. ^ SunOS 4.1.3 manual page for filesystem(7), dated 10 January 1988 (from the FreeBSD Man Pages library).
  20. ^ filesystem(7) – Solaris 11.4 Standards, Environments, Macros, Character Sets, and Miscellany Reference Manual.
  21. ^ "filesystem man page – Solaris 10 11/06 Man Pages". Archived from the original on 2007-07-04. Retrieved 2011-10-15.
  22. ^ "Index of /pub/Linux/docs/fsstnd/old/fsstnd-1.0/". Ibiblio.org. Retrieved 2012-10-16.
  23. ^ "Index of /pub/Linux/docs/fsstnd/old/fsstnd-1.1/". Ibiblio.org. Retrieved 2012-10-16.
  24. ^ "Index of /pub/Linux/docs/fsstnd/old/". Ibiblio.org. Retrieved 2012-10-16.
  25. ^ "FHS 2.0 Announcement". Pathname.com. Retrieved 2012-10-16.
  26. ^ Quinlan, Daniel (14 March 2012) [1997], "FHS 2.0 Announcement", BSD, Linux, Unix and The Internet – Research by Kenneth R. Saborio, San Jose, Costa Rica: Kenneth R. Saborio, archived from the original on 5 March 2016, retrieved 18 February 2016.
  27. ^ "Index of /pub/Linux/docs/fsstnd/". Ibiblio.org. Retrieved 2012-10-16.
  28. ^ "FHS 2.1 Announcement". Pathname.com. Retrieved 2012-10-16.
  29. ^ "FHS 2.1 is released". Lists.debian.org. 2000-04-13. Retrieved 2012-10-16.
  30. ^ Quinlan, Daniel (12 April 2000). "Filesystem Hierarchy Standard – Version 2.1, Filesystem Hierarchy Standard Group" (PDF). Acadia Linux Tutorials. Wolfville, Nova Scotia, Canada: Jodrey School of Computer Science, Acadia University. Archived from the original (PDF) on 27 March 2012. Retrieved 18 October 2012.
  31. ^ Russell, Rusty; Quinlan, Daniel, eds. (23 May 2001). "Filesystem Hierarchy Standard – Version 2.2 final Filesystem Hierarchy Standard Group" (PDF). Filesystem Hierarchy Standard. Retrieved 18 February 2016.
  32. ^ Russell, Rusty; Quinlan, Daniel; Yeoh, Christopher, eds. (28 January 2004). "Filesystem Hierarchy Standard - Filesystem Hierarchy Standard Group" (PDF). Retrieved 2014-11-29.
  33. ^ Yeoh, Christopher; Russell, Rusty; Quinlan, Daniel, eds. (19 March 2015). "Filesystem Hierarchy Standard" (PDF). The Linux Foundation. Retrieved 2015-05-20.