Free inodes: df -i

Updated November 1, 2026

df -h shows free space, df -i shows free inodes. They are different resources.

df -h .     # space in bytes
df -i .     # inodes: total, used, free

Sample output

$ df -i /data
Filesystem     Inodes IUsed IFree IUse% Mounted on
/dev/loop0         64    11    53   18% /data
$ for i in $(seq 1 56); do touch f$i; done
touch: cannot touch 'f54': No space left on device
...
$ df -h /data
Filesystem      Size  Used Avail Use% Mounted on
/dev/loop0       60M   24K   56M   1% /data
$ df -i /data
Filesystem     Inodes IUsed IFree IUse% Mounted on
/dev/loop0         64    64     0  100% /data

If df -i shows 100%, new files fail with 'No space left on device' even though df -h says there is room. The usual culprit is a directory with a million tiny files.

Common mistakes

'No space left on device' shows up both when blocks run out and when inodes run out. On a small filesystem with 64 inodes, touch f54 failed on inodes: df -i reads IUse% 100 while df -h next to it shows 56M free and Use% 1%. After an ENOSPC read both commands, df -h and df -i, or you will clean up the wrong resource.

Inside a container df -i / is often useless. In the course sandbox it prints the line overlay 0 0 0 - /: overlayfs reports no inode statistics, and a dash stands where the percentage should be. btrfs does the same. Real numbers come from a real filesystem: df -i /dev/shm gives 1538209 total and 1 used.

df -i says the inodes are gone but not where they went. Count by hand, directory by directory: for d in /usr /var /etc /home; do echo "$(find $d -xdev | wc -l) $d"; done | sort -rn prints 10827 /usr, 1131 /var, 529 /etc, 5 /home in the sandbox image. The -xdev flag matters: without it find walks onto other filesystems and the counts blur together.

Used in

You need this in the lesson Capacity planning.