π ~1 min read
Table of contents
Symptom & Impact
Services fail to write state, apt fails, and logs stop rotating when /var is full.
Environment & Reproduction
Frequently caused by log growth, package cache buildup, or crash dumps.
df -h /var
sudo du -xh /var | sort -h | tail
Root Cause Analysis
Unbounded data growth in /var consumes available blocks.
Quick Triage
Identify largest directories and stale package cache quickly.
sudo du -xh --max-depth=2 /var | sort -h | tail -n 20
Step-by-Step Diagnosis
Inspect logs, apt cache, and journal size contributors.
sudo journalctl --disk-usage
sudo du -sh /var/cache/apt /var/log /var/tmp

Solution – Primary Fix
Clean package cache and vacuum journal to recover space safely.
Still having issues? Our Server Management team can diagnose and resolve this for you. Get in touch for a free consultation.
sudo apt-get clean
sudo journalctl --vacuum-size=300M
sudo rm -rf /var/tmp/*

Solution – Alternative Approaches
Expand /var filesystem or move high-growth paths to dedicated storage.
lsblk -f
Verification & Acceptance Criteria
Sufficient free space returns and failed services recover.
df -h /var
sudo systemctl --failed
Rollback Plan
Restore archived logs if retention policy requires recovered files.
# restore from backup archive if needed
Prevention & Hardening
Implement quota/alerts and tune log retention.
sudo journalctl --vacuum-time=14d
Related Errors & Cross-Refs
Related to no space left on device and write failed errors.
Related tutorial: View the step-by-step tutorial for Ubuntu 24.04 LTS.
View all Ubuntu 24.04 LTS tutorials on the Tutorials Hub β
Browse all common problems & solutions on the Tutorials Hub.
References & Further Reading
Ubuntu storage management and journald retention guidance.
Need Expert Help?
If you cannot resolve this yourself, our team offers hands-on Server Management, Managed IT Services, and flexible Support Plans. Contact us today β we respond within one business day.