Linux Inodes Introduction

An Inode number is a uniquely existing number for all the files in Linux and all Unix type systems.

If a file is create on a system, a file name and Inode number is assign to it.

Normally, to access a file, a user uses the file name but internally file name is first mapped with respective Inode number store in a table.

Here : Inode doesn’t contain the file name. Reason for this is to maintain hard-links for the files. When all the other information is separate from the file name then only we can have various file names pointing to the same Inode.

Inode Contents

An Inode is a data structure containing metadata about the files.

Following contents are store in the Inode from a file:

User ID of file
Group ID of file
Device ID
File size
Date of creation
Permission
Owner of the file
File protection flag
Link counter to determine number of hard links

Like example of :

ls -ld new1  

See your terminal after run the command, it shows some of the Inode contents.

Inode Table

Inode table contains all the Inode and is create when file system is create.

The df -i command can be use to check how many inodes are free and left unuse in the filesystem.

The command “df -i” shows the usage of several file systems.

Inode Number

Every Inode has a unique number and Inode number can be seen with the help of ls -li command.

Directory Disk1 has the three files and each file has a different Inode number.

Here : The Inode doesn’t contain file content, instead it has a pointer to that data.

The inode (index node) is a data structure in a Unix style file system that describes a file-system object such as a file or a directory.

Each inode stores the attributes and disk block location(s) of the object’s data. File-system object attributes may include metadata (times of last change, access, modification), as well as owner and permission data.

If you understand this article then you can practice more and more for your ability. Thank you to give your time for this article.