A cPanel write fails with “No space left on device” but df -h shows 40% free. That’s an inode exhaustion event, not a space exhaustion event. The two failure modes look identical to applications and very different in the diagnostic.
What’s happening
ext4 and XFS allocate inodes statically (ext4) or dynamically (XFS) but in both cases run out is possible. ext4 inode count is set at mkfs time and cannot be expanded — running out means migrating to a bigger filesystem or to XFS. The cause is almost always an account that produced millions of small files: a runaway session directory, an unbounded mail spool, an overzealous cache.
How to verify
Confirm it’s actually inodes:
df -i
df -i /home
find /home -xdev -type f | wc -l
du --inodes -s /home/* 2>/dev/null | sort -n | tail -20
If df -i shows IUse% at 100%, you have the diagnosis. The du --inodes line ranks accounts by inode consumption.
The fix
- Identify the top inode-consuming account.
du --inodes -s /home/* | sort -n | tail -5. Drill into that account:du --inodes -s /home/<user>/* | sort -n | tail. - The usual suspects: PHP session files (
/home/<user>/tmp/sess_*), WordPress object cache (wp-content/cache/), maildir folders with millions of messages, npm/Composer caches in user homes. - Clean the offender: for PHP sessions,
find /home/<user>/tmp -name 'sess_*' -mtime +1 -delete. For caches, ask the application’s cache-clear command. For maildir, a more careful approach — coordinate with the customer. - After cleanup, verify with
df -ithat the inode pressure dropped. - Set up monitoring on
df -iif you don’t have it. Inode usage rarely shows up in default monitoring — it does in Munin and node_exporter’s filesystem collector. Alert at 80%. - Long-term: enforce per-account inode limits in
quota -u(cPanel sets these in package settings).
Stack Harbor sets inode monitoring as part of WHM server management onboarding.