Filesystem Hierarchy Standard
(FHS)
Filesystem Hierarchy Standard
The Filesystem Hierarchy Standard, or FHS, defines the directory structure and directory contents in Unix and Unix-like operating systems. It is maintained by the Linux Foundation.
On June 3, 2015, The Linux Foundation announced the release of FHS 3.0. The FHS 3 Specification Series (PDF, HTML) brings the first update in years, aligning with current usage patterns.
One notable change that occurred in FHS 3.0 is the definition of the
/run
directory. According to the FHS 3.0 specification:
This directory contains system information data describing the system since it was booted. Files under this directory must be cleared (removed or truncated as appropriate) at the beginning of the boot process.
The purposes of this directory were once served by /var/run
.
In general, programs may continue to use /var/run
to fulfill
the requirements set out for /run
for the purposes of backwards
compatibility. Programs which have migrated to use /run
should
cease their usage of /var/run
, except as noted in the section
on /var/run
.
Programs may have a subdirectory of /run
; this is encouraged for programs that use more than one run-time file. Users may also have a subdirectory of /run
, although care must be taken to appropriately limit access rights to prevent unauthorized use of /run
itself and other subdirectories.
Continuing on this subject, the discussion on /var/run
says:
This directory was once intended for system information data describing the system since it was booted. These functions have been moved to /run
; this directory exists to ensure compatibility with systems and software using an older version of this specification.
Please note that not only does the /run
directory take the place of the /var/run
directory, the /run
directory can also be set to use tmpfs. tmpfs is a common name for a temporary file storage facility on many Unix-like operating systems. It is intended to appear as a mounted file system, but stored in volatile memory instead of a persistent storage device. This means that any changes that are made to the /run
directory are not persisted and must be reapplied every time the system is booted.
Is My /run on tmpfs?
It is possible to determine if your /run directory is using tmpfs. Issue the command:
df | grep tmpfs
The output from such a command may be:
[root@hdcentos etc]# df | grep tmpfs devtmpfs 919028 0 919028 0% /dev tmpfs 934344 100 934244 1% /dev/shm tmpfs 934344 9120 925224 1% /run tmpfs 934344 0 934344 0% /sys/fs/cgroup tmpfs 186872 16 186856 1% /run/user/1002
The third line shows that /run is indeed running on a tmpfs system.