Skip to main content

What are inodes?

An inode is a data structure that stores all the metadata (type, owner, group, permissions, size, data location, etc.) of a file.

Each file or directory is represented by an inode that contains the above information.

All "ext" file systems use inodes.

  • The number of available inodes is defined when the file system is created and cannot be changed afterwards
  • An ext4 inode has a size of 256 bytes and therefore allocates storage space that cannot be used
  • We use the ext4 default "bytes-per-inode" ratio of one inode for every 16 KiB of storage space

On a 100 GB partition there will about 6 million inodes available.

Customers with a managed server will receive an automatic notification by email at 80 respectively at 90% inode usage.

If you have received such a notification, you can use the following command to find out at which placed in the filesystem these inodes are in use:

www-data@myserver:~ find /home /tmp -xdev -printf '%h\n' | sort | uniq -c | sort -k 1 -nr | head -n 20

An overview of the current inode usage can be displayed with the following command:

df -ih

Usually, increased inode usage involves many small files, e.g., temporary files such as sessions or cache. For such cases, we recommend using a cronjob to automatically delete files older than 14 days:

More often than not, these files turn out to be temporary files, such as session files or a local cache. In these cases, we recommend creating a cronjob that automatically removes these files after 14 days:

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

For testing purposes, before setting up the cronjobs, please use the command without the -delete option, as the command will delete found files within the given path without further question.

More information for setting up a cronjob can be found in the corresponding support article.