Runbook: Free disk space on a full Linux host
Find what filled the disk and reclaim space safely on a Linux server or CI agent.
Runbook: Free disk space on a full Linux host · #linux #docker #cleanup #disk #debugRunbook
Symptoms
Section titled “Symptoms”- Builds or writes fail with
No space left on device/ENOSPC. - Alert:
NodeFilesystemAlmostOutOfSpaceor disk usage > 90%.
- Which filesystem is full? Also check inodes (
df -i): Linux: Check disk usage per filesystem - What’s using it? Walk down from the mount point: Linux: Find the biggest directories
dfsays full butdudoesn’t add up? A process holds deleted files: Linux: Find deleted files still holding disk space- Docker host? Check how much is reclaimable: Docker: Show disk used by Docker
Work from safest to most aggressive:
- Old journal logs: Linux: Vacuum old journal logs
- Dangling images: Docker: Remove dangling images
- Rotated logs older than N days: Linux: Delete old rotated logs
- Deleted-but-open files: restart the process that holds them.
- Everything unused in Docker (destructive, check for local volumes first): Docker: Prune everything unused including volumes
Verify
Section titled “Verify”df -hTshows usage back under 80%.- The failed job or service is retried and succeeds.
Prevent / follow-up
Section titled “Prevent / follow-up”- Scheduled cleanup (cron or systemd timer) on CI agents.
SystemMaxUse=in/etc/systemd/journald.conf.- Alert at 80% instead of 95%.
Related
Section titled “Related”My DevOps Playbook by Angelo John Calleja