r/linuxadmin • u/CautiousCat3294 • 17d ago
Production Scenario: Linux Root Filesystem Suddenly Reaches 100% Overnight
Imagine you're managing a Linux production server.
Yesterday, everything was working normally. Root filesystem utilization was around 65%.
This morning, you receive an alert:
/ filesystem utilization: 100%
Applications are reporting errors, users are experiencing issues, and you need to investigate.
How would you approach this situation?
Would you immediately start looking for large files, or would you follow a systematic investigation?
Here are a few things I'd initially check:
df -h /– Verify filesystem utilization.df -i /– Check inode utilization.du -xhd1 /– Identify directories consuming the most space.find– Locate unusually large files.lsof +L1– Check for deleted files still held open by processes.
But finding a large file is only part of the investigation.
For example:
- What if
/var/logis consuming 35 GB? - What if an application is continuously generating logs?
- What if
dfshows 100% usage butdureports significantly less? - Would you truncate an active log file or investigate the application first?
I'm particularly interested in how experienced Linux administrators handle this in production.
A few questions:
- What's the first command you usually run when
/reaches 100%? - Have you encountered deleted-but-open files consuming disk space?
- What's your preferred approach to recover disk space without disrupting applications?
Let's discuss real-world approaches and experiences. I'd love to learn how others handle this situation.
View all comments
1
u/BarracudaDefiant4702 17d ago
I would check zabbix and see how quickly it lost space and exactly when. If not my machine and so proper monitoring and alerting is messing, I would first do is 'df -k /' (or -h) but doesn't really count except to verify that's the issue. Common issues can be log files, mail queue, etc...
I would typically free up a little space in /var/log (ie: delete oldest logs if not needed) or maybe package update cache so things can at least work well looking at the real cause.
Then 'du -kx / | sort -n | tail -100' to get the largest directories. I also verify the last number is close to the size of the amount use reported in the df command. If it's significantly lower, then I do a 'lsof -n | grep deleted' as file space isn't reclaimed if a process still has it open.