Article Title: UNIX: About inode. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
Have you ever tried UNIX? I am confused about the meanings of Iused and % Iused in commands (such as df), or when people talk about inode, what about cloud migration? UNIX and Linux? All systems use inode. Of course, IBM? AIX? Is no exception. This article will introduce you to what inode is, Why inode is very important for UNIX, the structure of inode, And the commands for operating inode.
Inode is a data structure in UNIX operating systems. It contains important information related to various files in the file system. When a file system is created in UNIX, a large number of inodes are created. Generally, about 1% of the disk space in the file system is allocated to the inode table.
Sometimes, people use different terms, such as inode and index number (inumber ). These two terms are very similar and correlated, but they do not refer to the same concept. Inode refers to the data structure, and the index number is actually the inode ID, so it is also called the inode number or index number. The index number is only an important part of file-related information. The next section describes some other attributes in inode.
The inode table contains a list listing all inode numbers of the corresponding file system. When you search for or access a file, the UNIX system uses the inode table to find the correct inode number. After the inode number is found, related commands can access the inode and make appropriate changes to it.
For example, you can use vi to edit an object. When you type vi You can open the inode only after the inode number is found in the inode table. Some attributes of the inode are changed during the editing session of vi. When you complete the operation and type: wq, The inode is disabled and released. In this way, if two users attempt to edit the same file, inode has been allocated to another user ID (UID) during the first edit session ), therefore, the second editing task must wait until the inode is released.
Inode Structure
For experienced UNIX developers or administrators, the inode structure is relatively simple, but there may be some surprising insider information about inode that you do not know yet. The following definition only provides some important information that UNIX users often use in inode:
Inode No.
Used to identify file types and pattern information for stat C Functions
File Link count
Owner UID
Group ID (GID) of the owner)
File Size
The actual number of disk blocks used by the file
Last modification time
Last access time
Last modification time
Basically, inode contains all information about the file (except the actual name of the file and the actual data content ). Can the Header file/usr/include/jf/ino. h In AIX, or Web page http://publib.boulder.ibm.com/infocenter/systems/index.jsp? The complete inode structure can be found in topic =/com. ibm. aix. files/doc/aixfiles/inode.h.htm.
The information listed above is very important for files and is frequently used in UNIX. Without such information, the file will be considered damaged and unavailable.
Compared with other operating systems, directories and files in UNIX systems may look different, but this is not the case. In UNIX, directories are files, but some additional settings are used in their inode. A directory is essentially a file that contains other files. In addition, some corresponding flags are set in the pattern information to inform the system that the file is actually a directory.
[1] [2] [3] Next page