Interview Prep/Linux/Storage, disks and filesystems

You get paged at 3 AM: the root filesystem on a production server is at 98% and climbing. Walk through your response.

BeginnerScenarioStorage, disks and filesystems
Answer

Situation read → Stop the bleeding first, then find the root cause in daylight.

What I'd do →

  1. Find what is growing:
df -h /
sudo du -xh --max-depth=1 / 2>/dev/null | sort -h | tail
sudo du -xh --max-depth=1 /var/log | sort -h | tail
  1. Quick safe wins: journalctl --vacuum-size=500M, remove rotated logs (*.gz), apt-get clean / dnf clean all.
  2. If a single log is huge and still open, truncate it rather than delete: sudo truncate -s 0 /var/log/app/app.log.
  3. Once stable, fix the cause (missing logrotate, debug logging left on, runaway dump files).

Why → du -x stays on one filesystem so mounted volumes don't confuse you, and truncating keeps the app's file handle valid.

Interview tip → Say "I buy time first, then write a ticket for the root cause and an alert at 80%."

All Linux questions Roadmap: Linux

More on Storage, disks and filesystems