I-node is a data structure that keeps track of all the information about a file. You keep your information in a file and the OS stores the information about a file in an I-node.
Data structures that contain information about files in UNIX file systems that are created when a file system is created. Each file has an I-node and is identified by an I-node number (I-number) in the file system where it resides. I-nodes provide important information on files such as user and group ownership, access mode (read, write, execute permissions) and type.
The I-node contains the following pieces of information:
- Mode/permission (protection)
- Owner ID
- Group ID
- Size of file
- Number of hard links to the file
- Time last accessed
- Time last modified
- Time I-node last modified
When a file is created inside a directory then the file-name and Inode number are assigned to file. These two entries are associated with every file in a directory. The user might think that the directory contains the complete file and all the extra information related to it but this might not be the case always. So we see that a directory associates a file name with its Inode number.
When a user tries to access the file or any information related to the file then he/she uses the file name to do so but internally the file-name is first mapped with its Inode number stored in a table. Then through that Inode number the corresponding Inode is accessed. There is a table (Inode table) where this mapping of Inode numbers with the respective Inodes is provided.