Review of linux root file system structure

Source: Internet
Author: User
Review of linux root file system structure
Liu Jianwen, http://blog.csdn.net/keminlau
) Intro

Although the linux root file system is integrated (all data directories are subdirectories under the root directory ), however, they are actually combined by multiple different Logical Subjects (to implement different logical functions). For more information, see. This also explains why some nodes (such as/var) can be attached to different disk partitions. Division of these logical parts will be of great benefit to a clear understanding of the root file system structure and the behavior of the entire system. Before division, let's take a look at "File System Structure standards ".

 

File System Structure Standard

Filesystem Hierarchy Standard
, Hereinafter referred to as FHS). One of the goals is that the program can be installed to a specified location by purpose, and the user can also predict the location of the installation files and directories of the program. FHS has achieved this goal by defining the meaning and purpose of each part of the file system and listing all special cases, such as historical issues.

Data Files in Linux systems can be classified according to [dual standards]: shared and exclusive (retriable vs. unretriable), changed and static (variable vs. Static ). If data files cannot be classified according to the double standard, they must be stored in another directory. The reason for this is that different [usage properties] (usage characteristics) data files are stored separately in different file systems (Disk Partitions.

  • Shared data is unrelated to the platform, for example,/usr. On the contrary, unshared data is platform-related, such as configuration data/etc.
  • "Static" data is relatively non-administrator users and has no changed permissions. "changed" data is the opposite. The purpose of separating static and dynamic data is to install static data into a single read-only medium (File System) without frequent transaction management with dynamic data, for example, regular backup.

Unlike data [Static and Dynamic] targeting "users", data [sharing specialization] targeting "hosts" means that some data is dedicated to the local machine, others are shared by multiple hosts (but local FHS compatible hosts can be remote hosts. For example, the root directory partition is dedicated to the local machine, and the/usr partition can be shared to multiple FHS compatible hosts.

Dual standards have evolved and are incorporated into FHS. To support this standard, data stored in/usr,/var,/etc and other directories by default has been adjusted accordingly.

Logical Structure of linux root file system

Referring to FHS, Linux systems are roughly divided into the following directories based on logical functions (expressing logical functions in specific directories is interesting ):

  • /
  • /Usr
  • /Var
  • /OPT
  • /Home

The p.s. directory can be installed on a separate partition, And the access root is mounted.

/(Dedicated static)

The function of the root directory is omitted by its name. The root directory is the root of the system (essential), and is the characteristic manifestation of the system. It can also be understood that the content of the root directory is not optional and is an essential part of the basic functions of the system.

P.s. How to understand "root "?

We know that Linux has a kernel, Shell, gred, and so on? There are vi, GCC, ifconfig, and a large number of applications under X. The so-called "root" includes the most basic and common content in terms of content performance. Of course, this part of content may be optional. It depends on how you define the basic system.

The logical functions of the root directory are divided into two layers. The first layer is applied, and the second layer is administrative. As mentioned above, the application layer is used to form basic systems, including common tools (such as LS, stored in/bin) and shared libraries. The second layer is for management purposes, including system startup, recovery, repair, and configuration. Because the root directory is the "root" of the system, its management purpose and host-related, it should be separately installed in a partition as small as possible.

How to define a basic system?

Since the computing system is basically logical, the definition of the basic system depends on the computing task, and the computing task itself is complex and diverse, it can only be described with a special example. For example, what systems need to be started, restored, repaired, and configured?

  • To boot a system, enough must be present on the Root partition to mount other fi lesystems. This includes des utilities, con resume guration, Boot Loader information, and other essential start-up data.
  • 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 fi lesystem.
  • To restore a system, those utilities needed to restore from system backups (on your oppy, tape, etc.) must be present on the Root fi lesystem

 

The root directory must be a directory
  • /Bin basic tools or commands
  • /Sbin system management tools or commands
  • /Etc host-related configuration data
  • /Lib basic shared library and kernel module
  • /Dev Device File
  • /Boot program
  • /Root administrator's working directory
  • /Temporary mount point of the MNT System Administrator
  • /Tmp system-level temporary file
  • /Media mobile device mount point
/Usr (shared static)

The/usr directory is a major component of the system. It is difficult to describe the use of/usr in one sentence. However, we can understand the role of/usr in the system by comparing the double standard nature of/usr with/and/var. First, like/,/usr is static. That is to say, common users of/usr cannot change the data. But unlike/,/usr is shared, the data in/usr is irrelevant to the host platform. We probably know that/USR and/are installed with binary programs, shared libraries, and configuration data, so the double standard nature of/usr can be inferred, the data and code are independent from the running host.

What about comparison with/var? /Var is basically dynamic and shared (a few are related to the host, such as/var/log ). /Var stores most of the dynamically generated data during the running period.

/Usr: A required directory.
  • /Usr/bin most USER commands
  • /Usr/include header into les encoded by C Programs
  • /Usr/blib Libraries
  • /Usr/local hierarchy (empty after main installation)
  • /Usr/sbin non-vital system Binaries
  • /Usr/share architecture-independent data
/Var

......

/Home: user home directories (optional)

......

Reference

Http://www.pathname.com/fhs/

Chapter 4. Overview of the directory tree (the Linux system administrators Guide)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.