Every file and folder uses one inode. A filesystem can exhaust inodes long before it exhausts bytes - classic offenders are old PHP session files, mail spools, cache folders, node_modules trees, and log or tmp directories that were never cleaned. The diagnostic split is simple: df -h measures bytes, df -i measures inodes. If bytes are free and inodes are at 100%, no amount of deleting large files will help - you must delete many small files.
X Writes fail with No space left on device while df -h shows free space
X Creating even an empty file fails: touch test returns the same error
X The machine holds a web server, mail, or years of accumulated cache and tmp files
X df -i shows IUse% at 100% on the affected filesystem
INODES 100% Bytes are free, file entries are not. The cure is deleting huge counts of small files, not big ones.
The fingerprint of this problem: df and df -i disagree - always trust df -i for this error.
rm -rf on the wrong folder is unrecoverable. Work directory by directory with the counting commands below, confirm each target, and never delete inside /proc, /sys, or a folder you have not identified first.One command pair settles the diagnosis and stops you deleting the wrong things.
df -h / and df -i / side by side (replace / with the affected mount if different).Do not guess. Count inodes per directory and drill down level by level. ⭐
sudo du --inodes -x / 2>/dev/null | sort -n | tail -20 - the largest counts are at the bottom.sudo du --inodes -x /var 2>/dev/null | sort -n | tail -20, and repeat until you reach the real offender./var/lib/php/sessions or a session folder, /tmp, a mail queue, a user cache, or an old backup made of tiny files.Clear contents, not the folders themselves, and prefer the tool each system already provides.
mailq and clear only stuck or ancient items through the mail tool, not by deleting spool files blind.rm -rf ~/.cache/* is safe for the current user - caches rebuild themselves.sudo systemd-tmpfiles --clean applies the configured age rules instead of you guessing.A process holding a huge deleted log keeps both its bytes and its inode alive - invisible to du, visible to lsof.
sudo lsof +L1 and look for lines marked (deleted) with large sizes.sudo systemctl restart <service>) - closing the handle releases the space and inode immediately.Confirm the table has room again, then remove the cause, not just the symptom.
df -i / - IUse% should be well below 100% and a test touch ~/inode-test && rm ~/inode-test should succeed.rm -rf /tmp/* on a live multi-user server without checking what active programs keep there. And do not reformat or recreate a filesystem to get more inodes as a first move - that erases everything and is only a last resort on a backed-up, rebuilt system.Every week: Windows problems, hidden tools and full setup guides, explained step by step.
Subscribe on YouTubeBecause there are two limits: total bytes and total inodes. df -h shows bytes; df -i shows inodes. Millions of tiny files - sessions, mail, cache entries - can use every inode while gigabytes remain free. When inodes hit 100 percent, creating any new file fails with No space left on device.
Count inodes per directory and drill down: sudo du --inodes -x / 2>/dev/null | sort -n | tail -20, then repeat inside the largest folder such as /var. Typical offenders are PHP session folders, /tmp, mail spools, caches, and folders with millions of small backup or node files.
Almost not at all. One file, however large, uses one inode, so deleting it frees one entry. An inode fix requires deleting large numbers of small files in the offending directory, or releasing deleted-but-open files held by a process, which lsof +L1 reveals.
When a process still has a deleted file open, Linux keeps its data and inode until the process closes it. A service holding a deleted multi-gigabyte log is the classic case. Find it with sudo lsof +L1 and restart that service to release the handle and free the space immediately.
Not on a mounted, in-use ext filesystem - the inode count is set when the filesystem is created. The practical fixes are clearing the small-file buildup, fixing the cleanup job that failed, and, only on a planned rebuild with full backups, recreating the filesystem with a higher inode ratio.