Introduction to the important knowledge of Linux system file system

Source: Internet
Author: User
Tags inode usage egrep

[Email protected]:~] $ls-lhi
Total 48K
3684713-RW-------1 root root 5.9K Jul 1 00:23 anaconda-ks.cfg
3684706-rw-r--r--1 root root 20K Jul 1 00:23 install.log
3684707-rw-r--r--1 root root 2.1K Jul 1 00:22 install.log.syslog
3684717-rw-r--r--1 root root 13:29 oldboy.txt

First column: Inode index node Number:

Second column: File type and permissions (a total of 10 characters, one character is type, and the last 9 characters are file permissions):

Column three: Number of hard connections:

Column Fourth: The User (group) to which the file or directory belongs

Column Fifth: The group to which the file or directory belongs:

Sixth column: size of file or directory:

第七、八、九 column: File or directory modification time:

Tenth column: The actual file name or directory name:

The second column: File types and Permissions: The last 9 bits, the first three bits are the sovereign limit, the middle three bits are the group permission bits, and the last three bits are the other permission bits.

Df-h View disk mount information in a human-readable manner,

-I view mounted disk inode usage

Summary of the Inode:

1) A certain number of inode and block are generated when the disk partition is formatted as a EXT4 file system. 、

2) The Inode is an index node that is used to store property information for the file and as an index to the file (the entity that points to the file)

3) The block of the Ext3/ext4 file system is the actual contents of the file.

4) Inode is a piece of storage space, C6 non-boot partition inode default size 256 bytes, C5 is 128 bytes.

5) The inode is a string of numbers, and the Inode (a string of numbers) corresponding to different files is unique within the file system.

6) Inode the same files, each other for hard connection files.

7) A file is created to occupy at least one inode and one block.

8) If a file is large, it may occupy multiple blocks, if the file is small, at least one, and the remaining space is wasted.

9) Inode, block size and total view: dumpe2fs/dev/sda3|egrep-i "block Size|inode size"

Dumpe2fs/dev/sda3|egrep-i "Block Count|inode count"

10) View the total inode volume and usage command df-i

11) How to generate and specify the inode size mkfs.ext4-b 2048-l 256/dev/sdb

Block is used to store the actual data, such as: photos, videos and other ordinary file data.

The inode is used to store the data attribute information (that is, the result of Ls-l), the inode contains the file's attribute information including file size, owner, attribution user group, read and Write permissions, file type, modification time, It also contains pointer functionality to the file entity (the corresponding relationship of the inode node--block), but the inode does not contain the file name alone.

In addition to logging information about file properties, the Inode also indexes information for each file.

Practical questions:

If you write data to disk, the following error is indicated: No space left on device, through Df-h view disk space, found not full, may I ask what is the reason?

Answer: It may be that the inode number is exhausted.

A.df-i to see if the inode count is exhausted

B. Enterprise work in the mail temporary queue/var/spool/clientmquene It is easy to get a large number of small files that cause no space left on device error. The Clientmquene directory will only be available if the SendMail service is installed.

cenos5.8 is installed by default sendmail,centos6.6 is not sendmail by default.

Block related knowledge:

1) The disk read data is read by block.

2) A file may occupy more than one block and consumes disk I/O once per block read.

3) If you want to improve disk IO performance, then try to

4) A block can only hold the contents of a single file, regardless of the size inside. If block 4 K, that store 1K of files, the remaining 3K is wasted.

5) block is not the bigger the better, the block is too large for small file storage will waste disk space, such as: 1000K files, Block 4K, occupy 250 Block,block 1 K, 1000 blocks, access efficiency who is the highest? The consumption of Io is 250 and 1000 times respectively.

6) Large file (larger than 16K) general settings block larger, small files (less than 1K) general settings block smaller.

7) block too large columns such as 4K, files are 0.1K, a lot of wasted disk space.

8) block too small columns such as 1K, files are 1000K, consumes disk IO.

9) block settings are also formatted when the partition, Mkfs.ext4-b 2048-l 256/dev/sdb

10) When the file is large, the block setting will increase the disk access efficiency.

) The Ext3/ext4 file is generally set to 4K.

Enterprise production about inode and block surface test case List

1, a 100 of the disk partition, write 1K files or write 1M files, respectively, how much can be written?

Block for 4K, 1M files will not have disk waste, so the number of files is about 100/1=100

For less than 0.1k, the inode consumes faster. The number of blocks in the default partition is greater than the number of inode.

Each small file will occupy an inode and block. So the number of final files: the number of inode

2. If you write data to disk, the following error is indicated: No space left on device, through Df-h view disk space, found not full, may I ask what is the reason?

Answer: It may be that the inode is exhausted.

A.df-i See if the inode is exhausted.

B. Enterprise work in the mail temporary queue/var/spool/clientquene It is easy to get a large number of small files that cause no space left on device error. The Clientmquene directory is a temporary queue for sendmail messages only if the SendMail service is installed. centos5.8 default will be installed sendmail,centos6.6 default no sendmail.

Introduction to the important knowledge of Linux system file system

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.