How to fix "No space left on device" error on Linux

Answered
Jan 05, 2026 364 views 1 answers
22

My server shows "No space left on device" error but df -h shows 40% free space. What is causing this and how to fix it?

P
Asked by python_dev
Platinum 447 rep

1 Answer

26

This can happen due to inode exhaustion or filesystem issues. Here's how to diagnose and fix:

Check inode usage

# Check inode usage
df -i
# Find directories with many files
find / -xdev -printf '%h
' | sort | uniq -c | sort -rn | head -20

Find and remove large files

# Find files larger than 100MB
find / -type f -size +100M -exec ls -lh {} \;
# Find largest directories
du -h --max-depth=1 / | sort -hr | head -20

Clean up common space consumers

# Clean apt cache
sudo apt clean
# Clean old kernels
sudo apt autoremove
# Clean logs
sudo journalctl --vacuum-time=7d
L
Answered by linux_expert 1 week, 2 days ago
Bronze 311 rep

Your Answer

You need to be logged in to answer questions.

Log In to Answer

Related Questions

Hot Questions

No hot questions available.