linux-file system management (basic concepts and frequently used commands)

1: partition type

Main partition: There can only be four partitions in total. In order to have more partitions, one needs to be taken out as an extended partition.

Extended partition: There can only be one, which is also counted as one of the main partitions, that is to say, there are at most four main partitions plus extended partitions. However, the extended partition cannot store data and be formatted, and must be divided into logical partitions before it can be used.

Logical partition: The logical partition is divided in the extended partition, if it is an IDE hard disk. Linux supports up to 59 logical partitions. If it is a SCSI hard disk, Linux supports up to 11 logical partitions. The illustration is as follows:

                                

Partition device file name:

     

Primary partition 1 /dev/sda1
Primary partition 2 /dev/sda2
Primary partition 3 /dev/sad3
Extended partition /dev/sda4
Logical partition 1 /dev/sda5
Logical partition 2 / dev / sda6
Logical partition 3 / dev / sda7

 

If there are only two primary partitions, one of which is an extended partition: then the file name of the partition device:

Primary partition 1 /dev/sda1
Extended partition /dev/sda2
Logical partition 1 /dev/sda5
Logical partition 2 / dev / sda6
Logical partition 3 / dev / sda7

2: File system:

ext2: is an upgraded version of the ext file system. The systems prior to Red Hat linux7.2 are all ext2 file systems by default. Released in 1993, it supports partitions up to 16TB and files up to 2TB (1TB = 1024G = 1024 * 1024KB).

ext3: The ext3 file system is an upgraded version of the ext2 file system. The biggest difference is the log function to improve the reliability of the file system when the system suddenly stops. Supports partitions up to 16TB and files up to 2TB.

ext4: ext4 is an upgraded version of the ext3 file system. ext4 has made a lot of improvements in performance, scalability and reliability. The transformation of EXT4 can be said to be earth-shaking. For example, it is backward compatible with EXT3, the maximum 1ET file system and 16TB files, an unlimited number of subdirectories, and the concept of Extents continuous data blocks. How fast to allocate. Delayed allocation, lasting preprocessing, fast FSCK, log verification, no day mode, online defragmentation, inode enhancement, default start barrier, etc. It is the default file system of CentOS 6.3. (1EB = 1024PB = 1024 * 1024TB)

3: File system view command df (statistics of file system occupancy)

You can use (command --help to view the help information of the command, or use the format of the man command); df [options] [mount point]

Options:

           -a Display file system information of all files, including special file systems, such as / proc, / sysfs

           -h Use customary units to display capacity, such as KB, MB, or GB.

           -T display file system type

           -m Display capacity in MB

           -k Display capacity in KB. The default is KB.

                 

                  

4: Statistics directory and file size du (generally do not use this command to view the file size, you can use ll -h to view)

      du [options] [directory or file name]

      Options: -a Show the disk usage of each subfile. By default, only the disk usage of subdirectories is counted

                  -h Use customary units to display disk usage, such as KB, MB, or GB.

                  -s Counts the total occupancy without listing the occupancy of subdirectories and subfiles.

The difference between the du command and the df command: the df command is considered from the file system, not only the space occupied by the file, but also the space occupied by the command or the program (the most common is that the file has been deleted, but the program has not released space ); The du command is file-oriented and only calculates the space occupied by files or directories.

5: File system repair command fsck

fsck [options] partition device file name

Options: -a: Automatically repair the file system without displaying user prompts

           -y: Automatic repair. Same as -a, but some file systems only support -y

6: show disk status command dumpe2fs

     dumpe2fs partition device file name

 

 

Published 148 original articles · Like 10 · Visitors 20,000+

Guess you like

Origin blog.csdn.net/ab1605014317/article/details/105399623