Knowledge base / Linux & server administration
Knowledge base / Linux & server administration
A full disk can stop databases, mail and logging, and sometimes the whole server. Here's how to find the cause quickly.
df -h # space df -i # inodes: millions of tiny files can fill a disk too
du -xh --max-depth=1 / | sort -h du -xh --max-depth=1 /var | sort -h
ncdu -x / gives an interactive view if it's installed. The usual suspects: /var/log, database binary logs, old backups, Docker images (docker system df), and package caches.
A deleted file that a process still has open keeps using space until the process closes it:
lsof +L1 | sort -k7 -n | tail
Restart or reload that process (often a log writer) to release the space.
/var/lib/mysql or similar by hand. Purge MySQL binary logs with PURGE BINARY LOGS.truncate -s 0 file.log rather than deleting it.dnf clean all or apt-get clean.