Check disk space
Shows filesystem disk space usage and types.
df -Th
A filesystem is at or near 100% and writes are starting to fail. All playbooks.
Find which filesystem is full.
Shows filesystem disk space usage and types.
df -Th
Find the biggest files on it.
Finds files over 100 MB on the root filesystem, largest first.
sudo find / -xdev -type f -size +100M -exec du -h {} + 2>/dev/null | sort -rh | head -20
From the full mount point, walk down the largest directories.
Lists the 10 largest files and directories here (dotfiles excluded).
du -hs * | sort -rh | head -10
If df says full but du doesn't add up, a process is holding deleted files open. Restart that process to free the space.
Lists files that were deleted but are still open. Their space is not freed until the process closes them, so a disk can be full while du looks fine.
sudo lsof +L1
Trim the systemd journal to 500 MB.
Caution. Deletes the oldest journal entries for good.
sudo journalctl --vacuum-size=500M
On Docker hosts, see how much space images, containers, volumes and build cache use.
docker system df
Remove dangling images.
Removes dangling images: untagged <none> layers left behind by rebuilds.
docker image prune -f
Delete old rotated logs, after checking the list.
Finds .log files older than 30 days under /var/log and deletes them.
Caution. Deletes files permanently. Run it once without -delete to see the list first.
sudo find /var/log -type f -name "*.log" -mtime +30 -delete