Free Disk Space Runbook
Analysis disk usage
Section titled “Analysis disk usage”sudo df -hsudo du -h --max-depth=2 /var | sort -hr | head -20sudo du -h --max-depth=2 /var/lib/rancher | sort -hr | head -2058G /var/lib58G /var54G /var/lib/rancher3.9G /var/lib/kubelet454M /var/log235M /var/log/pods194M /var/log/journal166M /var/lib/apt85M /var/cache79M /var/cache/apt19M /var/lib/dpkg4.3M /var/cache/debconf1.5M /var/cache/man1.3M /var/backups612K /var/lib/cni496K /var/lib/systemd368K /var/log/containers240K /var/lib/cloud92K /var/log/apt88K /var/lib/ucfjournal
Section titled “journal”Check journal size
sudo journalctl --disk-usagesudo journalctl --vacuum-time=7dVacuuming done, freed 3.7G of archived journals from /var/log/journal/c7360c702ef549138d59f24209d027ee.Vacuuming done, freed 0B of archived journals from /var/log/journal.sudo journalctl --vacuum-size=500MPackage Manager Apt
Section titled “Package Manager Apt”apt cleanapt autoremovetmp directory
Section titled “tmp directory”sudo rm -rf /tmp/*sudo rm -rf /var/tmp/*Containerd Image
Section titled “Containerd Image”# Remove all unused images (9gb)sudo k3s crictl rmi --pruneContainerd Pods
Section titled “Containerd Pods”Usually minimal gain
- Check size of pods directory
df -h /var/lib/rancherdu -sh /var/lib/rancher/k3s/agent/containerd6.5G /var/lib/rancher/k3s/agent/containerd- Removes pod sandboxes that are in a stopped state (not running).
# list: crictl podssudo k3s crictl rmp -aMost likely, k3s has been running for months without restart and has a memory leak.