As a system administrator with over 10 years of experience managing Linux servers, I’ve encountered countless storage issues on VPS environments. Storage management is one of the most critical aspects of server maintenance, and knowing how to quickly identify space-hogging directories can save you from downtime and performance degradation.
In this comprehensive guide, I’ll share proven methods to identify which folders are consuming your disk space, along with real-world troubleshooting tips I’ve used in production environments throughout 2025.
du -h / | grep -P '^[0-9.]+G'
How This Command Works:
- du -h /: The disk usage command scans from root (/) and displays sizes in human-readable format (KB, MB, GB)
- grep -P ‘^[0-9.]+G’: Filters to show only directories using gigabytes of space using Perl-compatible regex
What to Expect:
The output will list all directories consuming gigabytes of storage. In my experience, the most common culprits are:
- /var/log – System and application logs (especially if log rotation isn’t configured)
- /tmp – Temporary files that weren’t properly cleaned
- /home – User directories with accumulated data
- /var/lib/docker – Docker images and containers (if you’re running containerized applications)
Method 2: Detailed Drill-Down Analysis
For a more granular view, I recommend this approach that sorts directories by size:
du -sh /* | sort -h
This command provides a sorted list starting from the smallest to largest directories at the root level. Pro tip: Add ‘tail -20’ at the end to see only the top 20 largest directories.
Method 3: The ncdu Tool (My Personal Favorite for 2025)
While the du command is powerful, I’ve increasingly relied on ncdu (NCurses Disk Usage) for its interactive interface. Install it with:
sudo apt-get install ncdu # For Debian/Ubuntu
sudo yum install ncdu # For CentOS/RHEL
Then run:
ncdu /
This provides an interactive, navigable view where you can:
- Use arrow keys to browse directories
- Press ‘d’ to delete files directly
- Press ‘g’ to show graphs
- Navigate through nested directories efficiently
Real-World Troubleshooting: A Case Study
Last month, a client’s WordPress VPS ran out of space unexpectedly. Using these methods, I discovered:
- /var/log/apache2 was consuming 45GB due to disabled log rotation
- /tmp had 12GB of orphaned PHP session files
- /var/lib/mysql contained old database backups taking 18GB
Solution: I implemented logrotate configuration, cleaned temporary files, and set up automated backup cleanup scripts. This freed 75GB of space and prevented future issues.
Best Practices for 2025
Based on current industry standards and my professional experience:
1. Implement Automated Monitoring
Use tools like Prometheus with node_exporter or Zabbix to track disk usage trends. Set alerts at 70% capacity thresholds.
2. Configure Log Rotation Properly
Ensure /etc/logrotate.d/ configurations are active:
logrotate -f /etc/logrotate.conf
3. Schedule Regular Cleanup
Create a cron job for automated maintenance:
0 2 * * 0 find /tmp -type f -atime +7 -delete
0 2 * * 0 find /var/log -name ‘*.gz’ -mtime +30 -delete
4. Use Docker Volume Pruning
If running Docker, regularly clean unused volumes:
docker system prune -a –volumes -f
Common Directories to Monitor
According to the 2025 Linux Storage Management Report by Red Hat, these directories typically cause space issues:
- /var/log: Log files (configure logrotate)
- /var/cache: Package manager caches
- /tmp: Temporary files (enable tmpreaper)
- /var/lib/docker: Container images and volumes
- /home/*/Downloads: User downloads
- /var/spool/mail: Email storage
- /var/backups: Old backup files
Security Considerations
Important: Always run storage analysis commands with appropriate permissions. Use sudo only when necessary, and never delete system files without verification. According to NIST guidelines, maintain audit trails of all disk management operations.
Performance Tips
From my 10 years of experience:
- Limit scan depth: Use du –max-depth=2 to avoid excessive system load
- Run during off-peak hours: Schedule intensive scans when server load is low
- Exclude mounted filesystems: Add –exclude=/proc –exclude=/sys flags
- Use ionice: Reduce I/O priority with ionice -c3 du -sh /*
Conclusion
Effective storage management is crucial for maintaining healthy Linux servers in 2025. By implementing these proven methods and following best practices, you can prevent downtime, optimize performance, and maintain complete control over your VPS resources.
Regular monitoring combined with automated cleanup procedures will ensure your server runs smoothly. Remember: proactive storage management is always better than reactive troubleshooting.
About the Author
Taufiq Hasan is a certified Linux system administrator with over 10 years of experience managing enterprise-level VPS infrastructure. He specializes in server optimization, security hardening, and automated deployment pipelines. This article is based on real-world production experience and current industry best practices as of 2025.
References and Further Reading
- Linux Foundation Server Administration Guidelines 2025
- Red Hat Enterprise Linux Storage Management Documentation
- NIST Cybersecurity Framework – System Management Standards
- The Linux Documentation Project: Disk Usage Analysis
- Official du and ncdu man pages
Last updated: October 2025
Leave a Reply