Home / Guides

Server guide

Disk full on a Linux server: find it and free space safely

A full disk stops databases, mail and websites. The cause is almost always logs, backups, caches or a forgotten upload folder.

2 min readUpdated November 2026 by the RootManage teamWorks on Ubuntu, Debian, AlmaLinux and Rocky unless noted

The short answer

Run df -h, then du to find the biggest folder, clean logs, caches and old backups, and check inodes and deleted-but-open files if space does not come back.

How full is it?

terminal
df -h
df -i

df -h shows space. df -i shows inodes: a disk can be full of tiny files with plenty of space left.

Find the big folders

terminal
sudo du -xh / --max-depth=1 2>/dev/null | sort -h | tail -n 12
sudo du -xh /var --max-depth=2 2>/dev/null | sort -h | tail -n 12

Go one level deeper into the biggest folder, again and again. Install ncdu for an easier view.

Usual suspects

  • Logs in /var/log: rotate or compress them, and set a limit on the journal with journalctl --vacuum-size=200M.
  • Backups: on cPanel servers, /backup and /home/*/backup can grow fast.
  • Mail queue and spool: a spam problem can fill /var/spool.
  • Package caches: apt clean or dnf clean all.
  • Docker: docker system df, then docker system prune after reading what it will delete.
  • Core dumps and old kernels.

Space does not come back?

terminal
sudo lsof +L1 | head

A deleted file that a program still holds open keeps using space. Restart that program to release it.

Stop it happening again

  • Alert at 80% disk use.
  • Set log rotation for every app.
  • Keep backups on another system, not on the same disk.

Questions people ask

Is it safe to delete files in /var/log?

Truncate or rotate them instead of deleting: `truncate -s 0 file.log`. Deleting a log a program has open does not free space.

The disk is not full but I get "no space left"?

You may be out of inodes. Check df -i and look for folders with millions of small files, such as session or cache folders.

Should I grow the disk?

If the data is real and growing, yes. If it is junk, clean it first.

Want a person to look at it?

Tell us what you see. We reply with what we think is wrong and what it would take to fix it.