What is the role of inode nodes in Linux?

  

The inode in the Linux file system is mainly used to store the basic information of files and directories. When the system creates a file system, it will create a large number of inodes. The following small series will give you a detailed introduction to the role of inodes. Look.

a, inode what is?

To understand inodes, start with file storage.

The file is stored on the hard disk. The minimum storage unit of the hard disk is called “sector”. Each sector stores 512 bytes (equivalent to 0.5 KB).

When the operating system reads the hard disk, it does not read it one by one. This is too inefficient, but it reads multiple sectors at once, that is, reads one block at a time. ”(block). This "block" consisting of multiple sectors is the smallest unit of file access. The size of the block & rdquo;, the most common is 4KB, that is, a continuous block of eight sectors.

File data is stored in the "block", then obviously, we must also find a place to store the meta information of the file, such as the creator of the file, the date the file was created, the size of the file, etc. . This area for storing file meta information is called inode, and the Chinese translation is called "index node".

Second, the content of the inode

The inode contains the meta information of the file, specifically the following:

The code is as follows:

* The word of the file Number of sections

* User ID of the file owner

* Group ID of the file

* Read, write, and execute permissions of the file

* There are three timestamps: ctime refers to the time when the inode was last changed, mtime refers to the time when the file content was last changed, and atime refers to the time when the file was last opened.

* The number of links, that is, how many file names point to this inode

* The location of the file data block

You can use the stat command to view the inode information of a file: Br>

The code is as follows:

stat example.txt

In short, all file information except the file name exists in the inode. As for why there is no file name, the following will explain in detail.
Previous123Next page Total 3 pages

Copyright © Windows knowledge All Rights Reserved