Linux Filesystem Hierarchy Standard
EN
The Root Filesystem
The contents of the root filesystem must be adequate to boot, restore, recover, and/or repair the system.
To boot a system, enough software and data must be present on the root partition to mount other filesystems. This includes utilities, configuration, boot loader information, and other essential start-up data. /usr, /opt, and /var are designed such that they may be located on other partitions or filesystems.
To enable recovery and/or repair of a system, those utilities needed by an experienced maintainer to diagnose and reconstruct a damaged system must be present on the root filesystem.
To restore a system, those utilities needed to restore from system backups (on floppy, tape, etc.) must be present on the root filesystem.
- /bin : Essential user command binaries (for use by all users)
- /boot : Static files of the boot loader
- /dev : Device files
- /etc : Host-specific system configuration
- /home : User home directories (optional)
- /lib : Essential shared libraries and kernel modules
- /lib : Alternate format essential shared libraries (optional)
- /media : Mount point for removable media
- /mnt : Mount point for a temporarily mounted filesystem
- /root : Home directory for the root user (optional)
- /run : Run-time variable data
- /sbin : System binaries
- /srv : Data for services provided by this system
- /tmp : Temporary files
The /usr
Hierarchy
/usr is the second major section of the filesystem. /usr is shareable, read-only data. That means that /usr should be shareable between various FHS-compliant hosts and must not be written to. Any information that is host-specific or varies with time is stored elsewhere.
Large software packages must not use a direct subdirectory under the /usr hierarchy.
- /usr/bin : Most user commands
- /usr/include : Directory for standard include files.
- /usr/lib : Libraries for programming and packages
- /usr/libexec : Binaries run by other programs (optional)
- /usr/lib
: Alternate format libraries (optional) - /usr/local : Local hierarchy
- /usr/sbin : Non-essential standard system binaries
- /usr/share : Architecture-independent data
- /usr/src : Source code (optional)
The /var Hierarchy
/var contains variable data files. This includes spool directories and files, administrative and logging data, and transient and temporary files.
Some portions of /var are not shareable between different systems. For instance, /var/log, /var/lock, and /var/run. Other portions may be shared, notably /var/mail, /var/cache/man, /var/cache/fonts, and /var/spool/news.
/var is specified here in order to make it possible to mount /usr read-only. Everything that once went into /usr that is written to during system operation (as opposed to installation and software maintenance) must be in /var.
If /var cannot be made a separate partition, it is often preferable to move /var out of the root partition and into the /usr partition. (This is sometimes done to reduce the size of the root partition or when space runs low in the root partition.) However, /var must not be linked to /usr because this makes separation of /usr and /var more difficult and is likely to create a naming conflict. Instead, link /var to /usr/var.
Applications must generally not add directories to the top level of /var. Such directories should only be added if they have some system-wide implication, and in consultation with the FHS mailing list.
- /var/account : Process accounting logs (optional)
- /var/cache : Application cache data
- /var/crash : System crash dumps (optional)
- /var/games : Variable game data (optional)
- /var/lib : Variable state information
- /var/lib/
: Editor backup files and state (optional) - /var/lib/color : Color management information (optional)
- /var/lib/hwclock : State directory for hwclock (optional)
- /var/lib/misc : Miscellaneous variable data
- /var/lock : Lock files
- /var/lib/
- /var/mail : User mailbox files (optional)
- /var/opt : Variable data for /opt
- /var/run : Run-time variable data
- /var/spool : Application spool data
- /var/spool/lpd : Line-printer daemon print queues (optional)
- /var/spool/rwho : Rwhod files (optional)
- /var/tmp : Temporary files preserved between system reboots
- /var/yp : Network Information Service (NIS) database files (optional)
Operating System Specific Annex
Linux
- / : Root directory
- /bin : Essential user command binaries (for use by all
users) - /dev : Devices and special files
- /etc : Host-specific system configuration
- /proc : Kernel and process information virtual filesystem
- /sbin : Essential system binaries
- /sys : Kernel and system information virtual filesystem
- /usr/include : Header files included by C programs
- /usr/src : Source code
- /var/spool/cron : cron and at jobs
ZH
根文件系统
根文件系统的内容必须足以启动、还原、恢复和/或修复系统。
要启动系统,根分区上必须有足够的软件和数据来挂载其他文件系统。这包括实用程序、配置、启动加载器信息和其他重要的启动数据。/usr 、 /opt 和 /var 被设计成可以位于其他分区或文件系统上。
为了使系统能够恢复和/或修复,有经验的维护者在诊断和重建受损系统时所需的实用程序必须存在于根文件系统中。
要恢复系统,根文件系统上必须有从系统备份(软盘、磁带等)中恢复所需的实用程序。
- /bin : 基本的用户命令二进制文件(供所有用户使用)。
- /boot : 开机加载器的静态文件。
- /dev : 设备文件
- /etc : 主机专用系统配置
- /home : 用户主目录(可选)。
- /lib : 基本的共享库和内核模块。
- /lib
: 备用格式基本共享库(可选)。 - /media : 可移动媒体的安装点
- /mnt : 暂时安装的文件系统的挂载点
- /root : 根用户的主目录(可选)。
- /run : 运行时变量数据
- /sbin : 系统二进制文件
- /srv : 本系统提供的服务数据。
- /tmp : 临时文件
/usr 层次结构
/usr 是文件系统的第二个主要部分。/usr 是可共享、只读的数据。这意味着 /usr 应该是可以在各种符合FHS的主机之间共享的,不能被写入。任何主机特有的或随时间变化的信息都存储在其他地方。
大型软件包不得使用 /usr 层次结构下的直接子目录。
- /usr/bin : 大多数用户命令
- /usr/include : 标准include文件的目录
- /usr/lib : 用于编程和软件包的库
- /usr/libexec : 由其他程序运行的二进制文件 (可选)
- /usr/lib
: 备用格式库 (可选) - /usr/local : 本地层次结构
- /usr/sbin : 非必要的标准系统二进制文件
- /usr/share : 架构无关的数据
- /usr/src : 源代码 (可选)
/var 层次结构
/var 包含可变数据文件。这包括线轴目录和文件、管理和日志数据以及瞬时和临时文件。
/var 的某些部分不能在不同的系统之间共享,例如,/var/log 、 /var/lock 和 /var/run。例如,/var/log、/var/lock和/var/run。其他部分可以共享,特别是/var/mail、/var/cache/man、/var/cache/fonts和/var/spool/news。
这里指定 /var 是为了让 /usr 只读挂载成为可能。所有曾经进入/usr,并在系统运行过程中(相对于安装和软件维护而言)被写入的内容都必须在/var中。
如果 /var 不能成为一个独立的分区,通常最好将 /var 从根分区中移出,移到 /usr 分区中。(有时这样做是为了减小根分区的大小,或者当根分区的空间不够用时)。但是,不能将 /var 链接到 /usr,因为这样会使 /usr 和 /var 的分离变得更加困难,而且很可能造成命名冲突。相反,应将 /var 链接到 /usr/var。
应用程序一般不能在 /var 的顶层添加目录。只有当这些目录对整个系统有影响的时候才可以添加,并且要与FHS邮件列表协商。
- /var/account : 处理会计日志(可选)
- /var/cache : 应用程序缓存数据
- /var/crash : 系统崩溃转储(可选)
- /var/games : 可变的游戏数据(可选)
- /var/lib : 变量状态信息
- /var/lib/
: 编辑器备份文件和状态(可选) - /var/lib/color : 颜色管理信息(可选)
- /var/lib/hwclock : hwclock的状态目录(可选)
- /var/lib/misc : 杂项变量数据
- /var/lib/
- /var/lock : 锁定文件
- /var/mail : 用户邮箱文件(可选)
- /var/opt : /opt的变量数据
- /var/run : 运行时变量数据
- /var/spool : 应用程序线轴数据
- /var/spool/lpd : 行式打印机守护程序打印队列(可选)
- /var/spool/rwho : Rwhod文件(可选)
- /var/tmp : 系统重启之间保存的临时文件
- /var/yp : 网络信息服务(NIS)数据库文件(可选)
操作系统专用附件
Linux
- / : 根目录
- /bin : 基本的用户命令二进制文件(供所有用户使用)
- /dev : 设备和特殊文件
- /etc : 主机专用系统配置
- /proc : 内核和进程信息虚拟文件系统
- /sbin : 基本系统二进制文件
- /sys : 内核和系统信息虚拟文件系统
- /usr/include : C程序包含的头文件
- /usr/src : 源代码
- /var/spool/cron : cron和jobs