Linux Boot, Disk Full, Inodes & Performance Triage
When a Linux server crawls to a halt, throws "No space left on device" at 50% disk, or refuses to boot, you need fast, read-only diagnostics. Use this triage tree to isolate whether the bottleneck is CPU, RAM, Disk I/O, or Network before running any fix.
1 Disk Full & Inode Exhaustion
Linux can run out of space in two ways: blocks (big files filling GBs) or inodes (millions of tiny files using up all file-index slots). Sometimes a deleted file even stays locked in memory by a running app.
df -h
Disk Free (Human-Readable)
Use% in GB/MB. Watch / and /var.-T (df -hT) to also see filesystem types like ext4, xfs, or tmpfs.df -i
Inode Usage Check
df -h shows 45% free but apps say "No space left on device", check IUse% hereโmillions of tiny cache/session files can hit 100% inodes.sudo du --inodes -S / | sort -rh | head -n 10.du -sh /* | sort -h
Disk Usage Directory Ranking
-s summarizes each folder, -h uses MB/GB, and sort -h sorts human sizes from smallest to largest at the bottom.sudo du -sh /var/log/* | sort -h.sudo lsof +L1
Deleted-but-Open Files
rm that still lock disk space
systemctl restart <service>) to reclaim the GBs instantly.sudo find / -xdev -type f -size +100M -exec ls -lh {} + 2>/dev/null
2 CPU, Memory & I/O Triage
High load doesn't always mean a maxed-out CPU. Often the CPU is sitting idle waiting on a slow disk or swapping memory. Use these five commands together to pinpoint the real bottleneck.
uptime
1m / 5m / 15m Load Averages
nproc). Load 8.0 on 4 cores = overloaded; 8.0 on 16 cores = healthy.vmstat 1 5
Virtual Memory & CPU Queue
r (runnable processes waiting for CPU), b (blocked on disk I/O), si/so (swap in/out), and wa (% CPU waiting on disk).vmstatโit's the average since boot. Lines 2โ5 are live.free -h
RAM & Swap Usage
available columnโnot free. Linux uses spare RAM for disk cache (buff/cache) and gives it back instantly when apps need it.free -h -s 2 to watch RAM every 2 seconds during a memory leak.iostat -xz 1
sysstat package
-x shows extended metrics; -z hides idle disks. Watch %util (near 100% = saturated) and await (average ms per I/O request).await is <1ms; >20ms means storage is choking.sudo iotop -o
Per-Process Disk I/O
top, but ranks processes by disk read/write speed instead of CPU. -o hides idle processes so the culprit jumps out.iotop to group threads by process.wa) means Disk, not CPU!":
In top or vmstat, if CPU wa is 60% and us is 5%, your CPU is boredโit's stuck waiting on a slow hard drive or saturated SSD. Check iostat -xz 1 and iotop -o before upgrading CPU!
3 Systemd & Boot Recovery
Whether the server takes 4 minutes to boot, crashed on the previous boot, or dropped into a grub rescue> prompt, these tools show you what failed during startup.
systemd-analyze blame
systemd Boot Profiler
NetworkManager-wait-online).systemd-analyze critical-chain to see the exact blocking dependency chain.journalctl -b -1 -p err
Previous Boot Error Logs
-b -1 means previous boot (-b 0 is current boot), and -p err filters out info noise to show only errors and critical failures.journalctl --list-boots.sudo fsck -y /dev/sdb1
Unmounted Filesystem Repair
xfs_repair /dev/sdb1 instead.umount /dev/sdb1 firstโnever run fsck on a mounted read-write disk.GRUB Rescue Basics (When Bootloader Loses Its Partition)
If you see grub rescue>, GRUB can't find /boot/grub. List partitions with ls, locate the one containing /boot/grub, set root/prefix, and load the normal menu:
ls → ls (hd0,gpt2)/boot/grub → set prefix=(hd0,gpt2)/boot/grub → set root=(hd0,gpt2) → insmod normal → normal
4 Zombie Processes & OOM Killer
When Linux completely runs out of RAM, the kernel's OOM (Out-of-Memory) Killer sacrifices the biggest memory-hogging process to save the OS. Meanwhile, Zombie (Z) processes are already deadโjust waiting for their parent to clean up.
dmesg -T | grep -i oom
Kernel Ring Buffer
-T converts kernel timestamps into human-readable dates. Look for Out of memory: Killed process <PID>.dmesg wrapped, check journalctl -k | grep -i "killed process".ps aux | grep Z
Process State Check
STAT = Z) cluttering the process table
kill -9 won't remove a zombie because it's already dead.ps -eo pid,ppid,stat,comm | grep Z, then restart or signal the parent.5 The Danger Zone (What NOT To Do)
fsck on a mounted read-write filesystem
Running fsck while the OS or apps are actively writing to the disk causes severe metadata corruption and data loss.
sudo umount /dev/sdb1) or boot into a Live USB / single-user recovery mode for /.rm -rf on / with unquoted variables
In a script, rm -rf $BUILD_DIR/* becomes rm -rf /* if $BUILD_DIR is emptyโwiping the entire server.
rm -rf "${BUILD_DIR:?}/"* (aborts if unset or empty).kill -9 on databases (PostgreSQL, MySQL, Redis)
SIGKILL (-9) kills the process instantly without flushing dirty memory pages or closing write-ahead logs, risking table corruption.
sudo systemctl stop postgresql or kill -15 <PID> (SIGTERM) so the database shuts down cleanly.