A server runs out of disk space
Troubleshooting, Medium
An alert says the root volume of a Linux server is full, and the application cannot write. What you see:
- df -h / shows 50 GB size, 50 GB used, 0 available (100%).
- df -i / shows 8% of inodes used.
- du -xsh /* adds up to only 11 GB.
Say which commands you run, in order, what explains the missing 39 GB, how you free space safely without losing live data, and how you stop it happening again.
Examples
Input
df -h / and df -i /Output Blocks: 50 GB size, 50 GB used, 0 available (100%). Inodes: 8% used.
Why The numbers from the statement. Read both before you choose the next command.
Input
sudo du -xh --max-depth=1 / | sort -h | tail -4Output 6.1G /var, 3.2G /usr, 0.9G /home, 11G /
Why Shows where the visible files are and how much they add up to. Compare the total with what df reports.
Input Decoy:
du -sh /var/cache/apt /var/lib/apt/listsOutput About 1.2 GB.
Why Real waste you could clean, but small next to the amount that is missing.
Constraints
- One Linux server with a 50 GB root volume. The application cannot write.
- You have sudo on the server. A short application restart is allowed if you say why.
- Do not delete data you have not identified.
Your answer must contain
- The commands you run, in order, and what each one shows
- What explains the missing 39 GB
- How you free the space safely and confirm it
- How you stop it happening again