Skip to main content

inodes

An inode (index node) is a fundamental data structure in Linux file systems that stores essential metadata about files and directories, including:

  • File type
  • Ownership (user and group)
  • Permissions
  • File size
  • Data location
  • Timestamps

Every file and directory in ext file systems (e.g. ext2, ext3, ext4) is represented by a unique inode.

Limitations

  1. The total number of inodes is fixed when creating the file system.
  2. Once set, this number cannot be changed.
  3. Each ext4 inode occupies 256 bytes of storage space.

Allocation

ext4 uses a ratio of 1 inode per 16 KiB of disk space. This means that a 100 GB partition will have about 6 million inodes available.

Notifications

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 where in the file system these inodes are being used:

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

Cron Job

Typically, increased inode usage involves many small files, such as temporary files like sessions or cache. In such cases, we recommend using a cron job to automatically delete files older than 14 days:

tip

For testing purposes, before setting up the cron jobs, please use the command without the -delete option, as the command will delete any files found within the specified path without asking.

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

For more information on setting up a cron job, see the related support article.