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 →
- 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
- Quick safe wins:
journalctl --vacuum-size=500M, remove rotated logs (*.gz),apt-get clean/dnf clean all. - If a single log is huge and still open, truncate it rather than delete:
sudo truncate -s 0 /var/log/app/app.log. - 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%."
More on Storage, disks and filesystems
A new 200 GB EBS volume is attached to an EC2 instance. How do you make it usable and persistent across reboots?BeginnerThe `/var` LVM logical volume is nearly full and there is free space in the volume group. How do you grow it online?BeginnerThe volume group has no free space. You've been given a new disk. How do you add it to grow `/var`?IntermediateA cloud VM's root disk was enlarged from 30 GB to 80 GB in the console, but `df` still shows 30 GB. What do you do?BeginnerYou need to move a busy MySQL data directory from the root disk to a new, faster volume. Plan it.IntermediateA team wants a shared directory mounted on 10 app servers. How do you set up NFS?Beginner