Inode Concept Summary

Source: Internet
Author: User

One

The inode is a data structure in a file system on a Unix-like system. Data is stored on disk as a sector, and several sectors form a block, and the operating system reads the data on the disk efficiently, by block. The address of the block where the data is stored is contained in the inode.

Ii. storage information for the Inode

Each inode holds metadata information for a file system object (directory, file, pipeline, soft connection, socket, device file, etc.) as follows


    • The file size expressed in bytes.

    • The device ID that identifies the device that holds the file.

    • The user ID of the file owner.

    • The group ID of the file

    • The mode of the file, which determines the type of file and its owner, its group, and other users ' access to the file.

    • Additional system and user flags (flag) are used to protect the file.

    • 3 timestamps, recording the inode itself being modified (ctime, inodechange time), File contents modified (mtime, modificationtime) , the time of the last access (atime, accesstimes).

    • 1 links that indicate how many hard links are pointing to this inode.

    • A pointer to the file system storage location. Typically, the storage capacity of 1K bytes or 2K bytes is the basic unit.

Third, the role of the Inode

The operating system identifies the file as an inode number, and the inode number is unique within the same file system. When we open a file, the system according to the Inode number and file name in the directory control relationship, the file name into the inode number, and then the inode number corresponding to the Inode information pointed to the block address to open the file. This feature makes it possible to update a file that is being opened on Linux because the updated file is pointed to by a new inode and does not conflict with the original inode being used by the system, except that the control relationship in the directory has changed, and when the secondary file is opened again, The system opens the updated file.

650) this.width=650; "src=" Http://www.opsers.org/wp-content/uploads/2011/04/inode.png "alt=" Inode.png "/>

    • If the inode is insufficient, then storing the data on the file system will also report the error of insufficient storage space.

      It is possible that a large number of small files have been generated under a directory, consuming a large number of inode

    • The number of blocks stored in the Inode and block size limits the maximum single file size for a file system

Iv. Viewing the Inode method

[[email protected] ~]# ll -i /root            #查看文件inode编号, first column inode number TOTAL 4206271991 -RW-------.  1 root root  1598 jul 21 11:40 anaconda-ks.cfg  103963 drwxr-xr-x. 2 root  root    6 jul 21 11:42 desktop  103965 drwxr-xr-x .  2 root root    6 jul 21 11:42 documents 70662524  drwxr-xr-x. 2 root root    6 Jul 21 11:42  Downloads 70662525 drwxr-xr-x. 2 root root    6 jul 21  11:42 music138238502 drwxr-xr-x. 2 root root    6 jul  21 11:42 Pictures206272017 drwxr-xr-x. 2 root root     6 jul 21 11:42&nbsp public138238501 drwxr-xr-x. 2 root root    6 jul 21  11:42 templates206272018 drwxr-xr-x. 2 root root    6 jul  21 11:42 Videos[[email protected] ~]# df -i                  #查看文件系统inode占用情况Filesystem         inodes  iused    ifree iuse% mounted on/ dev/sda2      41943040 138671 41804369    1%  /devtmpfs         229955    389    229566    1% /devtmpfs             233586     10   233576    1%  /dev/shmtmpfs            233586    590    232996    1% /runtmpfs             233586     13   233573     1% /sys/fs/cgroup/dev/sda5      20971520     15  20971505    1% /testdir/dev/sda1         204800    330   204470    1% /boot/dev/sr0               0       0        0     - /run/media/ root/centos 7 x86_64tmpfs             233586      1   233585    1% /run/user/1001tmpfs             233586     17    233569    1% /run/user/42tmpfs             233586      1   233585    1 % /run/user/0

Five, hard connection and soft link

The creation of a hard connection is essentially a multiple name for the same physical file, pointing to the same inode, so it is not possible to build across the file system or establish a hard connection to the directory.

The creation of a soft link creates a new file, occupies an inode, points to a file name, and a soft connection establishes a cross-file system that can be set up on a directory.

    • Create a method

ln TARGET link_name #创建硬连接

Ln-s TARGET link_name #创建软连接

Note: When creating a soft connection, the target is relative to the path, or the relative path to the link_name ancestor directory

Ln-s Videos/movie/root/movie

A soft link to the/root/videos/movie directory is created.


This article is from the "Bronx" blog, please be sure to keep this source http://11801859.blog.51cto.com/11791859/1833710

Inode Concept Summary

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.