If your GitHub Actions job dies with No space left on device, the hosted runner's root disk filled up, usually because of Docker images, build caches, or a big dependency tree. Measure first with df -h and docker system df, then pick the cheapest fix that works: delete preinstalled toolchains you don't use, move Docker's storage to the runner's second disk, or move to a larger runner. Which one is right depends on whether you are over by a little or by a lot.
What does the failure actually look like?
The message varies depending on which process hit the wall:
Error: No space left on device : '/home/runner/work/_temp/_runner_file_commands/save_state_...' write /var/lib/docker/tmp/GetImageBlob...: no space left on device ENOSPC: no space left on device, write The first one is the runner agent itself failing to write a temp file, which is a good sign the whole root filesystem is full, not just your build directory. The second is Docker's layer storage. The third is Node, but the same error appears in any language. Don't be misled by the step that fails: the step that crossed the line is rarely the one that ate the space.
Takeaway: the failing step is only where the disk ran out, not where it was consumed.
Where did the disk go?
Add a diagnostic step at the start and end of the job before changing anything. This is what showed me the problem in my own case: the repo itself was tiny and Docker was the culprit.
- name: Disk report if: always() run: | df -h / /mnt echo "--- biggest top-level dirs on /" sudo du -xh / --max-depth=2 2>/dev/null | sort -rh | head -n 15 echo "--- docker" docker system df || true Run it twice, once as the first step and once with if: always() at the end. The difference between the two outputs tells you what your job consumed, versus what the image shipped with. As of late 2026, standard Linux hosted runners come with a lot of preinstalled software (Android SDK, .NET, Haskell, CodeQL bundles, many toolchains), and the root disk has limited free space left over after that. Check the current runner image documentation for the real numbers rather than trusting any figure from a blog post, including this one.
Also check /mnt. On standard Linux runners there is a separate temporary disk mounted there, and it typically has far more free space than /. That detail drives the second fix below.
Takeaway: diff df before and after the job, because the runner starts out partly full.
Which fix should I use?
| Approach | Typical effort | Helps when | Drawback |
|---|---|---|---|
| Delete unused preinstalled toolchains | A few lines of shell | You are over by a few GB | Adds time to every run, and removal can break steps that implicitly rely on them |
Move Docker data-root to /mnt | 5 lines of shell | Docker images/layers are the main consumer | Must be done before any image is pulled; conflicts with an existing daemon.json |
| Prune Docker between stages | One command | Multi-stage pipelines that build several images | Throws away the cache you may want later |
| Larger runner (paid) | Change runs-on | You need more disk and CPU anyway | Billed per minute at a higher rate; needs an org/enterprise plan on GitHub |
| Self-hosted runner | Highest | You need persistent caches or huge disks | You own patching, isolation, and security |
Takeaway: start with the free fixes, because they cost minutes of setup while a bigger runner costs money on every run.
How do I free space on the default runner?
Delete what you know your job doesn't touch. The directories below are the usual large ones on the Ubuntu image, but they change between image versions, so verify they exist with ls before depending on them, and make the step tolerant of missing paths:
- name: Free disk space run: | sudo rm -rf /usr/local/lib/android || true sudo rm -rf /usr/share/dotnet || true sudo rm -rf /opt/ghc || true sudo rm -rf /opt/hostedtoolcache/CodeQL || true df -h / In my testing this kind of deletion takes noticeable wall-clock time because it removes many small files, so measure it. If your job installs its own Node, Python, or Java, the preinstalled copies are safe to leave. Don't remove anything under /opt/hostedtoolcache wholesale unless you have confirmed that your setup actions download their own versions.
If you would rather not maintain the list yourself, the community action jlumbroso/free-disk-space wraps this pattern with toggles. If you want the cleanup packaged and configurable instead of hand-rolled, that is the one to look at, but pin it to a commit SHA, since it runs with sudo in your pipeline.
Takeaway: removing unused preinstalled SDKs is the cheapest fix, but it pays its cost in time on every run.
What if Docker is the problem?
When docker system df shows images and build cache dominating, point Docker at the larger /mnt disk before you pull or build anything:
- name: Move Docker storage to /mnt run: | sudo systemctl stop docker sudo mkdir -p /mnt/docker echo '{"data-root": "/mnt/docker"}' | sudo tee /etc/docker/daemon.json sudo systemctl start docker docker info --format '{{.DockerRootDir}}' The last line should print /mnt/docker. Two caveats. First, this overwrites /etc/docker/daemon.json; if the image already has one with settings you need, merge with jq rather than clobbering it. Second, ordering matters: images pulled before the move stay on the old disk and are no longer visible to the daemon, so put this step first in the job. If you build with docker/build-push-action and a BuildKit builder container, check that the builder you use actually stores its cache under the relocated root, because a docker-container driver keeps state in a volume that follows the daemon's storage.
For multi-image pipelines, docker builder prune -f between builds is often enough, at the cost of losing cache.
Takeaway: Docker layers are the most common space hog in CI, and /mnt is usually the roomiest place to put them.
When is a larger runner worth paying for?
If you are already deleting toolchains and relocating Docker and still running tight, or the job is also CPU-bound, the cleanup steps are a tax you pay forever. GitHub's larger runners give you more disk along with more cores, and if you want the managed fix instead of a script that can rot when the runner image changes, GitHub larger runners are the one that removes the disk constraint without touching your workflow logic. The honest drawbacks: they bill per minute at a higher rate than standard runners, they require a paid organization or enterprise plan, and you still need to confirm the disk size of the specific runner size you pick against current documentation.
Do the break-even in minutes, not feelings: take your cleanup time per run, multiply by runs per month, and compare to the price difference for your actual job duration at current published rates.
Takeaway: pay for a bigger runner when the cleanup steps cost more in minutes than the upgrade costs in dollars.
FAQ
Why does GitHub Actions say "No space left on device" when my repo is small?
The runner's root disk is shared with preinstalled toolchains and with everything your job creates, such as Docker layers, dependency caches, and build outputs. A tiny repo can still fill it through images and caches.
How do I check disk space in a GitHub Actions workflow?
Add a step that runs df -h / /mnt and docker system df, and run it at both the start and the end of the job with if: always().
Does cleaning the cache with actions/cache free runner disk?
No. The cache is stored remotely and restored onto the runner's disk, so a large restored cache actually consumes local space during the job.
Bottom line
If you are short by a few gigabytes, delete the SDKs you don't use. If Docker is the main consumer, move its data root to /mnt as the first step of the job. If you do both and still hit the wall, or your builds are slow anyway, price a larger runner against your actual cleanup minutes. Whatever you pick, keep the before-and-after disk report in the workflow so the next failure tells you where the space went.
