Полезная информация

Next Up Previous Contents Index

11.1 Filesystem Structure

Filesystem Structure

Red Hat Software is committed to the Linux File System Standard, a collaborative document that defines the names and locations of many files and directories. We will continue to track the standard to keep Red Hat compliant.

While compliance with the standard means many things, the two most important are compatibility with other compliant systems, and the ability to mount the /usr partition read-only. The /usr partition contains common executables and is not meant to be changed by users. Because of the, the /usr partition can be mounted from the CD-ROM or from another machine via read-only NFS. The current Linux Filesystem Standard (FSSTND) document is the authoritative reference to any FSSTND compliant filesystem, but the standard leaves many areas undefined or extensible. In this section we provide an overview of the standard and a description of the parts of the filesystem not covered by the standard.

The complete standard can be viewed at:

http://www.pathname.com/fhs/

11.1.1 Overview of the FSSTND

Overview of the FSSTND

The directories and files noted here are a small subset of those specified by the FSSTND document. Check the latest FSSTND document for the most up to date and complete information.

11.1.1.1 The /etc Directory

The <tt>/etc</tt> Directory

The /etc directory is reserved for configuration files that are local to your machine. No binaries are to put in /etc. Binaries that were in the past put in /etc should now go into /sbin or possibly /bin.

The X11 and skel directories should be subdirectories of /etc:

/etc
  |- X11
  +- skel

The X11 directory is for X11 configuration files such as XF86Config. The skel directory is for ``skeleton'' user files, which are files used to populate a home directory when a user is first created.

11.1.1.2 The /lib Directory

The <tt>/lib</tt> Directory

The /lib directory should contain only those libraries that are need to execute the binaries in /bin and /sbin.

11.1.1.3 The /sbin Directory

The <tt>/sbin</tt> Directory

The /sbin directory is for executables used only by the root user, and only those executables needed to boot and mount /usr and perform system recovery operations. The FSSTND says:

``/sbin typically contains files essential for booting the system in addition to the binaries in /bin. Anything executed after /usr is known to be mounted (when there are no problems) should be placed in /usr/sbin. Local-only system administration binaries should be placed into
/usr/local/sbin.''

At a minimum, the following programs should be in /sbin:

clock, getty, init, update, mkswap, swapon, swapoff, halt, reboot, shutdown, fdisk, fsck.*, mkfs.*, lilo, arp, ifconfig, route

11.1.1.4 The /usr Directory

The <tt>/usr</tt> Directory

The /usr directory is for files that are shareable across a whole site. The /usr directory usually has its own partition, and it should be mountable read only. The following directories should be subdirectories of /usr:

/usr
  |- X11R6
  |- bin
  |- dict
  |- doc
  |- etc
  |- games
  |- include
  |- info
  |- lib
  |- local
  |- man
  |- sbin
  |- share
  +- src

The X11R6 directory is for the X Window System (XFree86 on Red Hat Linux), bin is for executables, doc is for random non-man-page documentation, etc is for site-wide configuration files, include is for C header files, info is for GNU info files, lib is for libraries, man is for man pages, sbin is for system administration binaries (those that do not belong in /sbin), and src is for source code.

11.1.1.5 The /usr/local Directory

The <tt>/usr/local</tt> Directory

The FSSTND says:

``The /usr/local hierarchy is for use by the system administrator when installing software locally. It needs to be safe from being overwritten when the system software is updated. It may be used for programs and data that are shareable amongst a group of machines, but not found in /usr.''

The /usr/local directory is similar in structure to the /usr directory. It has the following subdirectories, which are similar in purpose to those in the /usr directory:

/usr/local
      |- bin
      |- doc
      |- etc
      |- games
      |- include
      |- info
      |- lib
      |- man
      |- sbin
      +- src

11.1.1.6 The /var directory

The <tt>/var</tt> directory

Since the FSSTND requires that you be able to mount /usr read-only, any programs that write log files or need spool or lock directories probably should write them to the /var directory. The FSSTND says /var is for

``... variable data files. This includes spool directories and files, administrative and logging data, and transient and temporary files.''

The following directories should be subdirectories of /var:

/var
  |- log
  |- catman
  |- lib
  |- local
  |- named
  |- nis
  |- preserve
  |- run
  |- lock
  |- tmp
  +- spool
      |- at
      |- cron
      |- lpd
      |- mail
      |- mqueue
      |- rwho
      |- smail
      |- uucp
      +- news

System log files such as wtmp and lastlog go in /var/log. The /var/lib directory also contains the RPM system databases. Formatted man pages go in /var/catman, and lock files go in /var/lock. The /var/spool directory has subdirectories for various systems that need to store data files.

11.1.2 /usr/local in Red Hat Linux

<tt>/usr/local</tt> in Red Hat Linux

In Red Hat Linux, the intended use for /usr/local is slightly different from that specified by the FSSTND. The FSSTND says that /usr/local should be where your store software that is to remain safe from system software upgrades. Since system upgrades from Red Hat Software are done safely with the RPM system and Glint, you don't need to protect files by putting them in /usr/local. Instead, we recommend you use /usr/local for software that is local to your machine.

For instance, let's say you have mounted /usr via read-only NFS from beavis. If there is a package or program you would like to install, but you are not allowed to write to beavis, you should install it under /usr/local. Later perhaps, if you've managed to convince the system administrator of beavis to install the program on /usr, you can uninstall it from /usr/local.


Next Up Previous Contents Index