File system structure
It is important to understand the difference between a file system and a directory. A file system is a section of hard disk that has been allocated to contain files. This section of hard disk is accessed by mounting the file system over a directory. After the file system is mounted, it looks just like any other directory to the end user.
However, because of the structural differences between the file systems and directories, the data within these entities can be managed separately.
When the operating system is installed for the first time, it is loaded into a directory structure, as shown in the following illustration.
The directories on the right (/usr, /tmp, /var, and /home) are all file systems so they have separate sections of the hard disk allocated for their use. These file systems are mounted automatically when the system is started, so the end user does not see the difference between these file systems and the directories listed on the left (/bin, /dev, /etc, and /lib).
On standalone machines, the following file systems reside on the associated device by default:
/Device | /File System |
---|---|
/dev/hd1 | /home |
/dev/hd2 | /usr |
/dev/hd3 | /tmp |
/dev/hd4 | /(root) |
/dev/hd9var | /var |
/proc | /proc |
/dev/hd10opt | /opt |
The file tree has the following characteristics:
- Files that can be shared by machines of the same hardware architecture are located in the /usr file system.
- Variable per-client files, for example, spool and mail files, are located in the /var file system.
- The /(root) file system contains files and
directories critical for system operation. For example, it contains
- A device directory (/dev)
- Mount points where file systems can be mounted onto the root file system, for example, /mnt
- The /home file system is the mount point for users' home directories.
- For servers, the /export directory contains paging-space files, per-client (unshared) root file systems, dump, home, and /usr/share directories for diskless clients, as well as exported /usr directories.
- The /proc file system contains information about the state of processes and threads in the system.
- The /opt file system contains optional software, such as applications.
The following list provides information about the contents of some of the subdirectories of the /(root) file system.
Item | Description |
---|---|
/bin | Symbolic link to the /usr/bin directory. |
/dev | Contains device nodes for special files for local devices. The /dev directory contains special files for tape drives, printers, disk partitions, and terminals. |
/etc | Contains configuration files that vary for each
machine. Examples include:
|
/export | Contains the directories and files on a server that are for remote clients. |
/home | Serves as a mount point for a file system containing
user home directories. The /home file system
contains per-user files and directories. In a standalone machine, a separate local file system is mounted over the /home directory. In a network, a server might contain user files that should be accessible from several machines. In this case, the server's copy of the /home directory is remotely mounted onto a local /home file system. |
/lib | Symbolic link to the /usr/lib directory, which contains architecture-independent libraries with names in the form lib*.a. |
/sbin | Contains files needed to boot the machine and mount the /usr file system. Most of the commands used during booting come from the boot image's RAM disk file system; therefore, very few commands reside in the /sbin directory. |
/tmp | Serves as a mount point for a file system that contains system-generated temporary files. |
/u | Symbolic link to the /home directory. |
/usr | Serves as a mount point for a file system containing
files that do not change and can be shared by machines (such as executable
programs and ASCII documentation). Standalone machines mount a separate local file system over the /usr directory. Diskless and disk-poor machines mount a directory from a remote server over the /usr file system. |
/var | Serves as a mount point for files that vary on each machine. The /var file system is configured as a file system because the files that it contains tend to grow. For example, it is a symbolic link to the /usr/tmp directory, which contains temporary work files. |