The app fails to write with "No space left on device", but `df -h` shows the volume is only 40% used.

BeginnerTroubleshootingDisk, memory and CPU
Answer

Likely causes → The filesystem ran out of inodes, not bytes. Millions of tiny files (session files, cache shards, mail queue, unpruned build artifacts) use up every inode while the space stays free.

Diagnose →

df -i /var
sudo find /var -xdev -type f | cut -d/ -f2-4 | sort | uniq -c | sort -nr | head

Fix → Delete or archive the small files (for a huge directory, find /var/lib/php/sessions -type f -mmin +1440 -delete is faster than rm *). Fix the app or cron job that creates them.

Prevent → Alert on inode usage, not only disk usage (node_filesystem_files_free / node_filesystem_files < 0.1). For ext4 volumes that hold many small files, create them with a higher inode ratio (mkfs.ext4 -i 4096) or use XFS, which allocates inodes dynamically.

All Real-World Interview questions Roadmap: Interview readiness

More on Disk, memory and CPU