A server reports `No space left on device` but `df -h` shows 40% free. What would you add to the health checks?
BeginnerScenarioScenarios: health checks, monitoring and alerts
Answer
Situation read → The filesystem has run out of inodes, usually from millions of tiny files (sessions, cache, mail queue).
What I'd do →
- Confirm:
df -i. - Find the directory:
find / -xdev -type d -size +1M 2>/dev/null(huge directories) or count files per directory withdu --inodes -x -d 2 / | sort -n | tail. - Add an inode check next to the disk check:
df -Pi -x tmpfs -x devtmpfs | awk -v t=90 'NR > 1 && $5 != "-" {sub(/%/, "", $5); if ($5+0 >= t) print $6, $5"%"}' - Fix the source: session cleanup, cache TTLs, tmpfiles rules.
Why → Inode exhaustion fails writes exactly like a full disk but is invisible to df -h.
Interview tip → Mention XFS allocates inodes dynamically while ext4 fixes the count at mkfs time, which is why this hits ext4 more.
More on Scenarios: health checks, monitoring and alerts
You are asked for a host health-check script covering disk, memory, systemd services and an HTTP endpoint. How do you design it?IntermediateYour disk alert fires and clears every few minutes around 80%, spamming Slack. How do you fix the alerting?AdvancedAlert when any certificate under `/etc/letsencrypt/live` expires within 21 days.IntermediateA developer wrote a Bash loop that restarts the app whenever its process disappears. What do you suggest instead?IntermediateYou suspect a memory leak in a service. How do you collect evidence with a script before involving developers?AdvancedHow do you know a scheduled job actually ran, not just that it did not report failure?Intermediate