Basic concepts of Linux disk partitioning and file system management

Source: Internet
Author: User

Device Files
The driver associated to the device, which is the access entry for the device

Device number
Major main device number, differentiating device type, used to indicate the driver required by the device
Minor device number to differentiate different devices under the same type

Create a device file
Mknod each device is a node.

View Device

10 represents the main device number
175,235,260 represents the secondary device number.

How to refer to a disk device
1. Device Name 2, Volume label 3, UUID

Disk devices
1. IDE device name:/dev/hd[a-z]
2, SCSI, SATA, USB, SAS device name:/dev/sd[a-z]
How do I identify a disk device if it has a partition? /dev/sda1/dev/sda2
Note: CentOS6 and CentOS7 all identify the hard drive device files as/DEV/SD

The

disk partition
disk partition is available in two ways: MBR and GPT
first of all, the MBR is not an MBA ha
0 sector (Sector No. 0, Master boot sector) is used to hold the master boot Record, A master boot record, such as when Windows starts, lets you choose to boot the system.
Each sector has 512 bytes, how does the MBR use partition space? 1, the first 446 bytes of storage bootloader, this is a program for booting the operating system 2, intermediate 64 bytes, storage partition table, each 16 bytes to identify a partition, so a disk up to 4 primary partitions, this is not changed.
Now the system can take the last part of the partitioned table as a record pointing to other storage spaces. This partition table can point to a hard disk and either part or all of the hard disk as a new partitioned table. The last primary partition is renamed an extended partition so that the extended partition cannot be used to store data. The extended partition points to the logical partition (the number of logical partitions is variable)
Note: Removing the primary partition is the last part, either 1 primary partitions plus an extended partition, or 2 primary partitions plus an extended partition. The partition number for the
primary partition is only 1 2 3 4
Logical partitions are partitioned at 5.

Formatting
Low-level formatting, made at the factory, used to divide tracks
Advanced formatting is the creation of file systems
Advanced formatting
The storage space of the metadata is created first within the specified partition, similar to the directory, and the function is to efficiently and quickly query the data. Such a partition is divided into two storage spaces, one for storing metadata and the other for storing real data.
The metadata for the file is Inode-->index node: Contains file size, permissions, owner, group timestamp, data block pointer (this pointer limits the size of the unit file), metadata does not include the file name, and the file name is stored in the data disk because the file name is the real data of the directory file.
In fact, metadata is a data structure, and each file has the same metadata component. The metadata is created when the format is formatted, but the contents of the metadata are empty.
Data storage
In a file system, data is not stored in sectors, but in blocks. Several sectors make up a block of data. The file system uses data blocks to store data, and the data blocks are allocated for the entire block, and no decimal blocks appear.
After the data block is formed, the system allocates the content type of the data block, some data blocks hold the metadata, and some data blocks hold the real data.
Symbolic link file (soft link file)
The metadata for the normal file is pointing to the real data, but the metadata of the linked file points to the metadata of the other file (the data block pointer stores the access path to the real file)
Symbolic links support the creation of symbolic links to directories that can cross file systems (point to different partitions). If the original file is deleted, the symbolic link file becomes invalid. Access to a symbolic link file does not get any information. The permission for the symbolic link is 777
Hard link file
A different file that points to the same inode. The directory does not support hard links, hard links cannot cross the file system, and creating hard links increases the inode count.
When will the link file be used?
When more people need to modify a file at the same time, but do not want to let the operator know the actual file name.

Device files
In other words, the device file, the data block of the device file is the device's main device number and the secondary device number.

Disk Block bitmap index (bitmap index bitmap)
Used to identify whether the disk block is empty and Indoe has a bitmap index.

Reserved space
For root user use, how much to leave (CentOS7 reserved 5%), who decides? It is up to the File System Management tool to specify parameters when creating the file system.

Block groups Data Block group
This concept is too low-level, after a specific application in the specific description. It is only necessary to know that the disk is not only two data areas (metadata area and data region), the disk is divided into blocks, block groups are composed of blocks, each block group has a metadata area and data area. The metadata area holds the number of data blocks that are available in this data set. In the metadata area also holds a data called Super block, this data more than one copy, this data is mainly to inform the basic situation of the disk (how many block groups, the storage capacity of each block group)

Focus on the inode.

68 The first number is the inode number, the machine is the inode number, the person identifies the file name, the inode is similar to the page number, according to the page number to find the data.

File system directory
First of all, the root directory is recognizable by the kernel (this is the premise, I can't explain it now). The inode of the root directory is in the kernel, and the root directory's metadata is found based on the inode of the root directory, and the block storage blocks of the root directory are found based on the metadata. The data storage block of the root contains the directory name and its corresponding inode number of the first-level directory under the root directory.

Swap file System swap
The simple point of this file system is to use disk space as memory.

System directory Considerations
/bin/sbin/etc/lib/lib64 These partitions must be in the root partition
/usr/var These two directories can be partitioned separately.

Basic concepts of Linux disk partitioning and file system management

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.