Sobes.tech
Middle

What is an inode and what to do if inodes are exhausted?

sobes.tech AI

Answer from AI

inode is a data structure in Unix-like operating systems' file systems that stores metadata about a file: access rights, owner, size, references to data blocks, etc. Each file or directory has its own unique inode.

If inodes are exhausted, it means that the file system has reached its limit on the number of files, even if there is free space on the disk. This can happen with a large number of small files.

What to do:

  • Delete unnecessary files, especially temporary files and logs.
  • Find directories with a huge number of files (for example, using find or ls) and clean them.
  • If possible, recreate the file system with a larger number of inodes (during formatting, for example, mkfs -i for ext4).
  • Use other file systems that handle a large number of small files better.

Example of finding directories with a large number of files:

for dir in /*; do echo $dir; find $dir | wc -l; done
What is an inode and what to do if inodes are… - sobes.tech