Skip to content
Latchkey

How to Manage Disk Space in CI for Large Repos

A large checkout plus Docker images fills a runner fast; df -h, docker system prune, and removing unused toolchains reclaim gigabytes.

The error no space left on device is common on large-repo builds. Inspect with df -h, then reclaim space by pruning Docker, deleting caches, and removing preinstalled SDKs the job does not use.

Steps

  • Run df -h to see what is full before and after cleanup.
  • Run docker system prune -af to drop unused images and layers.
  • Delete large preinstalled toolchains you do not need.

Free space example

.github/workflows/ci.yml
- name: Free disk space
  run: |
    df -h
    docker system prune -af --volumes
    sudo rm -rf /usr/local/lib/android /opt/ghc /usr/share/dotnet
    df -h

Gotchas

  • GitHub-hosted Ubuntu runners ship many SDKs preinstalled; removing unused ones reclaims tens of gigabytes.
  • Do not delete a toolchain your job needs; verify the path is safe before rm -rf.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →