Digital Communication


Digital Communication

Inode: the data structure of Unix systems


Inodes correspond to a structure for managing file systems in Unix-based operating systems. Inodes therefore represent data headers in inode lists or similar data structures. They contain metadata about stored files. This metadata is similar to, among other things, information such as access rights, storage location, group, user number or dates relating to modifications or accesses.

What is an inode?

The term “inode” is short for “index node”. This is a form of file management that has played an essential role since the deployment of the Unix operating system and other systems based on it, such as Linux or macOS. The main functions of inodes with respect to file systems are to reference, manage and locate specific files in a system through unique and distinctive inode numbers. As defined data structures, inodes are used to describe and manage specific files through metadata. The nature of this metadata depends of course on the file system in question.

If they contain no information about the name of the file itself, the inodes generally contain the information below about files and file blocks :

  • Type and access rights
  • Number of permanent links
  • User ID (UID)
  • Group number (GID) or group identifier (GUI)
  • File size (in bytes)
  • Date of last modification (mtime)
  • Date of last status change (ctime)
  • Date of last access (atime)
  • Address of data blocks
  • Address of indirection blocks
  • Number of links
  • Version number

How do inodes work?

Unix systems do not manage hard disk partition sectors by clustering, but as data blocks. Unlike the DOS system, inodes are created instead of file allocation tables (FAT) for managing and referencing directory data. If data is stored on the hard disk in fixed blocks, the size of a file can quickly exceed the space available in the block’s memory. The system must then find another block available to store the rest of the file. This is precisely where inodes come into play.

Inodes allow you to find data stored in a system using reference data, directory data and their inodes, including through a unique inode number. They are not dependent on the file name, which is a huge advantage. In the case of a copied and renamed file, it suffices to find it using the same inode number as that of the original file. This is what happens with permanent links created by users using the Linux ln command. If this form of internal accounting is advantageous, it is in particular because the inodes refer both to the original files and to their respective backups, without monopolizing more memory.

As the inodes are created in a fixed way according to the system, it can happen that a file is too large compared to the available inodes. In such a case, the original inode then points to another inode, also known as indirection blockwhich contains the remaining metadata.

As the size of the inodes is defined from the start according to the system, it is possible that the inodes will not be sufficient if the number of files is large. It is then necessary to restructure the file system by providing a greater number of inodes.

Where are inodes used?

Inodes are used to manage and structure file systems. They are also used both in private Linux systems and in managed services solutions. Whether you are an individual user or you represent a company, if you are looking for a cloud tool for servers with Unix-based operating systems, you can therefore turn to data structures using inodes. As with most cloud services, it can be a public cloud or a private cloud; it all depends on your needs.

What file systems support inodes?

All of the Unix-based operating systems, such as Linux or macOS, use inodes. However, the structure and configuration of these inodes may vary depending on the file system that supports them. Thus, in the ext2/ext3/ext4 systems, they take the form of lists or tables of inodes and correspond to headers of descriptive data. The list of inodes is unique and established when the system is created; it is therefore impossible to modify it afterwards. Also, ext4 inodes of 256 bytes take up fixed storage space in memory, and it is impossible to use it otherwise. In these data systems, each inode describes a file or directory in the system using the corresponding metadata.

However, with the more complex filesystems, like xfs or btrfs, inodes are generated only if they are needed for locating files. In such cases, no inode lists or tables are used. Other operational differences also exist between inodes on hard disks (“Disk Inodes”) and inodes dedicated to Linux memory processing (“In Core Inodes”).

Overview of the main commands related to inodes

Since the number of available inodes is limited depending on the file system you are using, you need to know how to display the occupied inodes, or more precisely the slots occupied by the inodes within the system. This information is needed whenever there are not enough inodes available for additional files.

Command to display occupied locations in the file system

To display the locations occupied by inodes in your file system, you can use the following command:

~ find /home /tmp -xdev -printf ´%h \n´ | sort | uniq -c | sort -k 1 -nr | head -n 20


Command to get an overview of busy inodes

To display all busy inodes in your system, use the following code:

This command gives you an overview of inode usage, including associated filesystem, total number of inodes, occupancy, and unoccupied inodes:

Command to display a specific inode number

To display the specific inode number of a file, you can use the command below:

Command to display all files in an inode

Want to know which files (including original files, copies, or backups) are referenced by an inode? Use the following code:

Tips for Heavy Inode Usage

You can use inodes heavily without it necessarily meaning that you are about to run out of storage capacity. Most of the time, high inode usage can be related to superfluous small data elements, such as temporary TMP files, caches, or sessions. To solve this problem, it is usually enough to configure the automatic deletion of all files older than 14 days. To do this, run a cron job using the following command:

03 *** /usr/bin/find /path/to/files/* -type f – mtime +14 -delete > /dev/null 2>&1


What happens if there are no inodes?

If you no longer have enough inodes for new files, you are likely to observe the following phenomena:

  • Application blocking
  • Data loss
  • Unplanned reboot
  • Stopping processes without restarting
  • Scheduled processes unable to start automatically

If you are at the maximum capacity of your inodes, we advise you to free some of the occupied memory. You also have the option, through a fairly complex process, of restructuring the filesystem to increase your maximum number of inodes.

Télécharger notre livre blanc

Comment construire une stratégie de marketing digital ?

Le guide indispensable pour promouvoir votre marque en ligne

En savoir plus

Souhaitez vous Booster votre Business?

écrivez-nous et restez en contact