Filesystem Hierarchy

A question for you: with all the Linux distributions out there, how can you be sure that the filesystem hierarchy will be reasonably consistent from one distribution to the next? In other words, will you be able to find similar files in similar directories when using Red Hat as opposed to Debian? It's likely you will. The reason lies in the Filesystem Hierarchy Standard, or FHS.

The FHS " ... consists of a set of requirements and guidelines for file and directory placement under UNIX-like operating systems." FHS is a standard that's intended to make application interoperability, system administration tools and documentation more uniform across the many distributions of Linux. While compliance with FHS is completely voluntary, it's widely used and accepted. After all, if everyone else is compliant, why would you want to be the odd man out? Some of the key elements of the FHS are as follows.

The FHS breaks files and directories out into four basic categories: a) shareable, b) unsharable, c) static, and d) variable. Shareable data can, indeed, be shared between several different hosts, while unsharable cannot. An example of the former is user /home directories. The latter would include lock files. Static files are any that do not change without sysadmin intervention, while variable files or directories may change without such intervention. This breakdown is necessary to determine the remaining layout of an FHS-compliant filesystem.

FHS also addresses the root filesystem, requiring that specific directories be located within the / directory. These include /bin, /sbin, /var/, and /lib, among others. The required directories within the / filesystem should, according to the standard, be sufficient to boot the system from this directory alone. There should also be files adequate to restore, repair and recover the system in the event of a failure.

The second requirement addresses the /usr directory. The existence of the /usr hierarchy creates a common location for shareable read-only (or static) data. This includes X11R6 and games.

FHS, in its third requirement, establishes the /var hierarchy. This data, consistent with the four defined data types, contains variable data. This data may or may not be shared across a network, but can be changed without sysadmin intervention. The /var hierarchy contains spool files, logs and other variable and/or temporary files.

Variances for specific operating systems are allowed, but only within the narrowly-defined parameters of the FHS.

It's because of the FHS that you can reasonably expect to find similar file structures across the many Linux distributions. If you're new to Linux, it's good to know that there's really some reason and consistency to what often seems like a mysterious stack of directories.

The Filesystem Hierarchy Standard is a copyrighted document available in full at http://www.pathname.com/fhs/pub/fhs-2.2.pdf. Copyright � is held by Daniel Quinlan (1994-2001) and Paul 'Rusty' Russell (2001).

 

Reply via email to