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 stored in the Inode from a file:
User ID of fileGroup ID of fileDevice IDFile sizeDate of creationPermissionOwner of the fileFile protection flagLink counter to determine number of hard links
For example:
ls -ld new1
See your terminal after running the command, it shows some of the Inode contents.
Inode Table
Inode table contains all the Inode and is created when file system is created.
The df -i command can be use to check how many inodes are free and left unused 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.