Docs / Troubleshooting / Fixing Disk Full Errors

Fixing Disk Full Errors

By Admin · Feb 25, 2026 · Updated Apr 23, 2026 · 28 views · 1 min read

Symptoms

When a disk is full, you may see errors like "No space left on device", services crashing, or inability to create files. Even databases can corrupt if they cannot write.

Quick Assessment

# Check all filesystems
df -h

# Check inode usage (can be full even with free space)
df -i

Find What Is Using Space

# Largest directories
du -h --max-depth=1 / 2>/dev/null | sort -rh | head -15

# Common space hogs
du -sh /var/log/*
du -sh /tmp/*
du -sh /var/cache/*

Quick Cleanup

# Truncate large log files (don't delete — services may hold file handles)
sudo truncate -s 0 /var/log/syslog
sudo truncate -s 0 /var/log/kern.log

# Clean package manager cache
sudo apt clean

# Remove old journals
sudo journalctl --vacuum-size=100M

# Find files over 100MB
find / -type f -size +100M -exec ls -lh {} \; 2>/dev/null

Handle Deleted-But-Open Files

A deleted file still uses space if a process has it open:

# Find deleted files still using space
sudo lsof +L1 | grep deleted

# Restart the service to release the file handle
sudo systemctl restart rsyslog

Prevention

  • Set up log rotation (/etc/logrotate.d/)
  • Monitor disk usage with cron alerts
  • Use tmpwatch or tmpreaper to clean temporary files

Was this article helpful?