Linux root file system

Source: Internet
Author: User
Tags temporary file storage

Linux root file system is a file system first, but compared with a common file system, it is special that it is the first file system mounted when the kernel is started, the kernel code image file is stored in the root file system, and the system boot program loads some basic initialization scripts and services to the memory for running after mounting the root file system.

First, we will learn some information about the root file system from the Linux operating system installed on the host. For example, the following results can be obtained in the Linux Desktop System I work on:

#
Mount

/Dev/hda2
On/type ext3 (RW)

None
On/proc type proc (RW)

/Dev/hda1
On/boot type ext3 (RW)

None
On/dev/PTS type devpts (RW, gid = 5, mode = 620)

None
On/dev/SHM type tmpfs (RW)

#
DF

Filesystem 1k-blocks used
Available use % mounted on

/Dev/hda2 16216016 5667684 9724600 37%
/

/Dev/hda1 101089 9321 86549 10%
/Boot

None 63028 0 63028 0%
/Dev/SHM

 

From the above mount command, we can see that in Desktop Linux, the root file system "/" is mounted to the/dev/hda2 device, and the file system type is ext3, if the attribute is RW, you can read and write data. From the DF command, you can get more information about the space used by the root file system.

The root file system has always been an important part of all UNIX-like operating systems. It can also be considered as an important feature that distinguishes embedded Linux systems from other traditional embedded operating systems, it brings many powerful and flexible functions to Linux, but also brings some complexity. We need to clearly understand the basic structure of the root file system, carefully select the required system library, kernel modules and applications, and configure various initialization script files, and select the appropriate file system type and place it in the appropriate location of the actual storage device.

Basic directory structure of the root file system

The linux root file system is organized in a tree structure, including the various files and programs required by the kernel and system management, generally, the top-level directories under the root directory "/" have some fixed names and purposes.

The following lists the common directory structures in a linux root file system:

2./bin directory for storing binary executable commands

2./dev directory for storing Device Files

2./etc directory for storing system management and configuration files

2./home indicates the user's home directory. For example, if the user's home directory is/home/user, you can use ~ User

2./lib directory for storing dynamic link shared libraries

2./sbin stores the directory of management programs used by the system administrator.

2/tmp public temporary file storage point

²/Root system administrator's home directory

2. The MNT system provides this directory for users to temporarily Mount other file systems.

2. The/proc Virtual File System can directly access this directory to obtain system information.

²/Var overflow of some large files

²/USR: the largest directory. Almost all the applications and files to be used are in this directory.

 

Most of these directories should be familiar to users who often use Linux. However, several directories are confusing for beginners, such as/bin,/sbin,/usr/bin and/usr/sbin. Here is a brief introduction of their differences: the/bin directory is generally stored as a required binary file for users and systems, while the/sbin directory is to store binary files only for system management, files in this directory will not be used by common users. On the contrary, unnecessary user binaries are stored under/usr/bin, and unnecessary system management tools are stored under/usr/sbin. In addition, some local libraries are very similar. For those commands that require system startup and running, they must be stored in the/lib directory, you can store other non-essential inventory in the/usr/lib directory.

For the root file system of the embedded Linux system, it may not be as complex as listed above. For example, the embedded system is generally not intended for multiple users, therefore, the/home directory may be rarely used in embedded Linux, the/boot directory depends on whether the bootloader you use can obtain the kernel image from your root file system before the kernel starts. Generally, only/bin,/dev,/etc,/lib,/proc,/var,/usr are required, while others are optional.

Related Article

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.