An inode (short for "index node") is a data structure Linux uses to store information about a file. Each inode has a unique ID that identifies an individual file or other object in the Linux file system.
Inodes contain the following information:
- File type - file, folder, executable program etc.
- File size
- Time stamp - creation, access, modification times
- File permissions - read, write, execute
- Access control list - permissions for special users/groups
- File protection flags
- File location - directory path where the file is stored
- Link count - number of hardlinks to the inode
- Additional file metadata
- File pointers - addresses of the storage blocks that store the file contents
Notably, an inode does not contain the filename or the actual data. When a file is created in the Linux file system, it is assigned an inode number and a filename. This linked pair allows the filename to be changed without affecting the file ID in the system. The same holds true when renaming directories, which are treated as files in Linux.
File data is stored across one or more blocks on the storage device. An inode includes a pointer to this data but does not contain the actual data. Therefore, all inodes are relatively small, regardless of the size of the files they identify.
NOTE: Each Linux storage device has an inode limit, which is defined when the disk is formatted. In rare cases, when many small files are created, the inode limit may be reached before the full storage capacity has been used.