An inode (index node) is a filesystem data structure in Unix-like operating systems that stores metadata about a file or directory, including its size, ownership, permissions, timestamps, and pointers to its data blocks on disk. Notably, the filename is not stored inside the inode; instead, directories act as lookup tables that map human-readable filenames to unique inode numbers.
How it works
When an application opens a file by path, the kernel traverses the directory hierarchy to map the filename to an integer inode number. Using that number, the kernel locates the corresponding entry in the filesystem's inode table to verify access permissions and follow block pointers to the actual file contents.
Because filenames live separately in directory entries, a single inode can be referenced by multiple names—a concept known as a hard link. Modifying permissions or contents through one hard link immediately affects all others because they share the exact same underlying inode. By contrast, a symbolic link creates its own separate inode that simply stores a text path pointing to another filename.
In traditional filesystems such as ext4, a fixed number of inodes is allocated when the volume is formatted—typically at a default ratio of one inode per 16 KB of storage capacity. Dynamic filesystems like XFS and Btrfs allocate inodes on demand as long as free disk space remains.
Example
You can inspect the inode number and metadata of any file using standard Linux utilities, and check overall filesystem inode consumption with df -i:
$ ls -i app.log
1048592 app.log
$ stat app.log
File: app.log
Size: 4096 Blocks: 8 IO Block: 4096 regular file
Device: 801h/2049d Inode: 1048592 Links: 1
Access: (0640/-rw-r-----) Uid: ( 1000/ deploy) Gid: ( 1000/ deploy)
$ df -i /var
Filesystem Inodes IUsed IFree IUse% Mounted on
/dev/sda1 655360 655360 0 100% /var
In the df -i output above, /var has reached 100% inode utilization. Even if gigabytes of free disk space remain, any service attempting to create a new file, PID lock, or temporary socket on that mount will fail with a "No space left on device" error.
What matters when choosing a server or hosting
- Shared hosting inode caps: Shared web hosts impose strict per-account inode limits to prevent a single tenant from overwhelming backup systems and metadata caches. WordPress sites with heavy caching plugins, uncompressed media thumbnails, or uncleaned email mailboxes often hit these ceilings before reaching their storage quota.
- VPS and dedicated filesystem choices: When provisioning your own block storage for workloads that generate millions of tiny objects—such as mail queues, PHP session stores, or container image layers—choose XFS or format ext4 with a higher inode density (
mkfs.ext4 -i 4096). - Backup and snapshot performance: High inode counts directly slow down file-level operations like
rsync,tar, and antivirus scans, even when total data size is small.
Common mistakes
- Monitoring disk space without monitoring inodes: Alerting only on
df -hleaves servers vulnerable to silent outages caused by runaway session files or mail queues exhausting the inode table. - Assuming deleting empty files frees block space: Removing zero-byte files reclaims inodes, whereas truncating a massive active log file (
: > app.log) frees disk blocks without changing inode usage. - Using hard links across different filesystems: Inode numbers are only unique within a single mounted filesystem, so hard links cannot span separate partitions or volumes.
FAQ
Can I increase the number of inodes on an existing ext4 partition?
No. On ext4, the inode ratio is set at creation time and cannot be increased without backing up the data, reformatting the filesystem with a custom bytes-per-inode setting, and restoring the files. Growing the underlying partition size will, however, add new block groups with additional inodes.
Why does my server say "No space left on device" when df -h shows free space?
This usually means the filesystem has run out of free inodes, or an unlinked file is still held open by a running process. Run df -i to verify whether IUse% has reached 100%.
Do directories and symbolic links consume inodes?
Yes. Every directory, regular file, symbolic link, socket, and device node consumes one inode. Only hard links share an existing inode without allocating a new one.