quickstart →

Fix "No space left on device" in GitHub Actions

Fix "No space left on device" in GitHub Actions: see what fills the disk, free space on ubuntu-latest, use /mnt, and get a runner with a bigger disk.

A job fails with one of these, usually in a Docker build, a large npm install, an Android or ML build, or a test that writes a lot of data:

No space left on device
System.IO.IOException: No space left on device
ERROR: failed to solve: ResourceExhausted: ... no space left on device
You are running out of disk space. The runner will stop working when the machine runs out of disk space.

The runner’s disk is full. On standard GitHub-hosted runners that happens sooner than you’d think: GitHub documents 14 GB of SSD for them, and the root filesystem is shared with the many tools preinstalled in the image. This page shows how to see what’s using the space, then the fixes from the cheapest to the most effective.

See what is using the disk#

Add a step before the failing one (and one with if: always() after it) to see free space and the biggest directories. It’s a quick diagnostic, and always() runs it even when the job has failed or been cancelled:

.github/workflows/ci.yml
- name: Disk usage
if: always()
run: |
df -h
df -i /
sudo du -xh --max-depth=1 / 2>/dev/null | sort -rh | head -15
docker system df || true

While the root disk is full, the step after the failure can fail with the same error before it prints anything: the runner first writes each run: script to $RUNNER_TEMP, which is on that disk. The step before the failing one is the one to rely on.

df -h shows each filesystem. Note which one your job writes to: the workspace ($GITHUB_WORKSPACE, under /home/runner/work), Docker’s data (/var/lib/docker, and /var/lib/containerd with Docker 29), and the temp directory ($RUNNER_TEMP) are all on the root disk by default. On Linux x64 runners a second, larger temporary disk is often mounted at /mnt: if df -h shows one, you can move heavy data there (see below). The exact sizes change with image updates, so read them from your own run.

If df -h shows free space where your job writes, two other limits can give the same error. A filesystem can run out of inodes (one per file) while it still has free bytes: df -i then shows IUse% at 100%. And in a container: job or a service container, /dev/shm is only 64 MB, Docker’s default. Tools that share memory between processes, such as PyTorch’s multi-process data loaders, can outgrow it: raise it with options: --shm-size=2g on that container.

Ubuntu 26.04 images ship Docker 29. Its containerd image store keeps each image layer both compressed and unpacked, so image-heavy jobs need more room on 26.04 than on 24.04. GitHub moves ubuntu-latest from Ubuntu 24.04 to Ubuntu 26.04 gradually between October 19 and November 19, 2026; during that window a run can land on either. Pin ubuntu-24.04 or ubuntu-26.04 to move on your own schedule.

1. Remove preinstalled tools you don’t use#

The Ubuntu image ships Android SDKs, .NET, Haskell, Swift, CodeQL bundles and several Docker images, which add up to tens of gigabytes. Deleting the ones your job doesn’t need is the quickest fix:

.github/workflows/ci.yml
- name: Free disk space
uses: jlumbroso/free-disk-space@v2
with:
android: true
dotnet: true
haskell: true
large-packages: true # apt packages such as LLVM, browsers, cloud CLIs
docker-images: true
preinstalled-runtimes: false # keep the Node/Python/Go/Ruby versions setup-* actions use
swap-storage: false

large-packages uninstalls apt packages and takes several minutes. Turn it off if the other options free enough space.

Or by hand, for the biggest directories:

.github/workflows/ci.yml
- name: Free disk space
run: |
sudo rm -rf /usr/share/dotnet /usr/local/lib/android /usr/local/.ghcup /opt/hostedtoolcache/CodeQL
sudo docker image prune --all --force
df -h /

This step takes from a few seconds to a couple of minutes (deleting is I/O too), so keep only the directories that make a difference.

2. Use the second disk#

If /mnt has room, put the heavy data there instead of on /:

.github/workflows/ci.yml
- name: Move Docker's data to /mnt
run: |
mountpoint -q /mnt || { echo "::warning::/mnt is not a separate disk on this runner"; exit 0; }
sudo systemctl stop docker.socket docker containerd
for d in docker containerd; do
sudo mkdir -p "/mnt/$d"
sudo mount --bind "/mnt/$d" "/var/lib/$d"
done
sudo systemctl start containerd docker
- name: Build in /mnt
run: |
sudo mkdir -p /mnt/build && sudo chown "$USER" /mnt/build
cmake -S . -B /mnt/build && cmake --build /mnt/build

The Docker step bind-mounts empty directories on /mnt over both /var/lib/docker and /var/lib/containerd, so Docker starts again with an empty image store on the second disk. Images already on /, such as the ones the Ubuntu image ships, stay there under the mount and keep their space: to free it, run the image cleanup from section 1 before this step. Setting data-root in daemon.json is not enough on Docker 29: images and build layers stay in /var/lib/containerd, on /.

Not every run gets the second disk, even on the same label: if the Docker step warns, the job has only /. Don’t use that step in a job with services:. The service containers start before the first step, and stopping Docker stops them. The same goes for a Docker container action whose image the runner builds from a Dockerfile before the first step: the restart leaves that image behind in the old store, and the action fails. The step can’t work in a container: job either, because its script runs inside the job container.

maximize-build-space ↗ goes further and merges free space from both disks into one LVM volume mounted on the workspace.

3. Write less#

  • Docker builds: use a .dockerignore, multi-stage builds, and docker builder prune -af between builds in the same job. BuildKit’s own cache counts too: with cache-to: type=gha,mode=max every intermediate layer is exported, which takes space during the build. See Docker layer caching.
  • Caches and artifacts: restoring a cache unpacks it on the disk (a 5 GB compressed cache can take 15 GB). Cache less, or cache per job; see caching dependencies.
  • Matrix jobs: split a job that builds everything into a matrix of smaller ones; each gets its own disk.
  • Clean as you go: delete build directories and downloaded archives once a step no longer needs them.

4. Get a runner with a bigger disk#

When the job really needs the space, a bigger machine is the fix that doesn’t need maintenance:

  • GitHub larger runners on Linux and Windows come with 150 GB of SSD at 4 vCPUs up to 2,040 GB at 64 and 96 vCPUs. Ubuntu also has a 2-vCPU size with 75 GB, at the same per-minute rate as the standard Linux runner in a private repository ($0.006 a minute on x64): the cheapest GitHub-hosted runner with a bigger disk. Larger runners need the Team or Enterprise Cloud plan, are billed per minute, and aren’t free in public repositories.
  • Self-hosted runners have whatever disk you give them. On ephemeral cloud runners, size the volume for the job and it’s thrown away afterwards. A runner that stays up between jobs fills up with Docker images, build caches and old workspaces. Clean them up in a script that runs before each job (ACTIONS_RUNNER_HOOK_JOB_STARTED). For Docker, docker system prune -af --filter until=48h removes only unused data older than two days, so recent images and build cache stay warm. Or use ephemeral runners.
  • RunsOn runs each job on an EC2 instance in your AWS account, with the disk size you set in the volume label:
.github/workflows/ci.yml
jobs:
build:
runs-on: runs-on=${{ github.run_id }}/runner=4cpu-linux-x64/volume=120gb

You can also pick an instance type with local NVMe storage: usually a d variant such as m8id or c8gd, or a storage-optimized family such as i7ie, which has no d. RunsOn puts the workspace, Docker’s data and /tmp on that disk, so the local disk’s size, not volume, is what counts. On a large-memory instance, extras=tmpfs puts them in RAM instead.

Windows and macOS#

The same message appears as System.IO.IOException: There is not enough space on the disk on Windows. The Windows image is large, and the D: drive usually has more free space than C:: set your build and cache directories there. On macOS runners, df -h shows what is full, and removing unused Xcode versions or simulators (sudo rm -rf /Applications/Xcode_<old>.app, xcrun simctl delete unavailable) frees the most space. No GitHub-hosted macOS runner has a bigger disk, large and xlarge included: they all have 14 GB, so remove what you don’t use.