What is an inode

File systems, in general, have two parts: the metadata or the “data” about the data and the data itself. Metadataconsist of information about the data. More precisely it includes information such as the Access Control List (ACL), the date the file was modified, file owner, file permissions, size of file, device ID, uid of the file, etc. This type of information is key to a file system otherwise we just have a bunch of bits on the storage media that don’t mean much. Inodes store this metadata information and typically they also store information about where the data is located on the storage media.
In a file system, inodes consist roughly of 1% of the total disk space, whether it is a whole storage unit (hard disk, thumb drive, etc.) or a partition on a storage unit. The inode space is used to track the files stored on the hard disk. The inode entries only points to these structures rather than storing the data. Each entry is 128 bytes in size.Space for Inodes is allocated when the operating system or a new file system is installed and when it does its initial structuring. So this way we can see that in a file system, the aximum number of Inodes and hence maximum number of files are set. Now, the above concept brings up another interesting fact. A file system can run out of space in two ways:
  • No space for adding new data is left
  • All the Inodes are consumed.
To get a listing of an inode number, use ls -i command.
ls -li
total 3336
57741 -rw-r--r-- 1 root root 3412144 Nov 20 17:26 coreutils-8.22-18.el7.x86_64.rpm
57725 -rw-r--r-- 1 root root       0 Apr  7 04:00 file
57736 -rw-r--r-- 1 root root       0 Apr  7 04:00 new-file

# ls -li new-file 
57736 -rw-r--r-- 1 root root 0 Apr  7 04:00 new-file

# find /root -inum 57736
/root/new-file