Blog

Free disk space in GitHub Actions: each option, measured

We measured what each way of freeing disk on a GitHub-hosted runner gives, and what it costs in time. Three options free 14 GB in under 40 seconds.

Free disk space, measured. A terminal card on a metal slab: df -h, a short usage bar, was 13 GB free, now 49 GB free in blue.

A job on a private repository’s GitHub-hosted runner starts with about 14 GB of free disk, and most of the rest is taken by tools the job may never use. Deleting some of them is the usual way to get room, often with the free-disk-space action. We measured what each option frees and how long it takes, on Ubuntu 24.04 and 26.04, in a private and a public repository, on 22 November 2026.

The short answer: three options free about 14 GB in under 40 seconds; everything frees about 36 GB in four to five minutes; and the swap option frees nothing.

How much is free when a job starts

RunnerDiskFree at the start
Private repository, Ubuntu 24.04 (2 CPUs)75 GB13.4 to 16.9 GB
Private repository, Ubuntu 26.04 (2 CPUs)75 GB15.4 GB
Public repository, Ubuntu 24.04 (4 CPUs)150 GB91.5 to 94.9 GB
Public repository, Ubuntu 26.04 (4 CPUs)150 GB93.5 GB

Free space differs from one runner to the next on the same image, by up to 3.5 GB. GitHub promises 14 GB.

What takes the space

The largest folders on both images, in GB:

WhatWhereSize
Android SDK/usr/local/lib/android11.3
.NET/usr/share/dotnet6.4
Tool cache: Python, Go, Node.js, Ruby, PyPy, CodeQL/opt/hostedtoolcache5.3
Haskell/usr/local/.ghcup3.7
Swift/usr/share/swift3.5
Docker images/var/lib/docker (24.04), /var/lib/containerd (26.04)2.6 (24.04), 3.5 (26.04)
Swap file/swapfile3.1
Java/usr/lib/jvm1.3 to 1.5
PowerShell/usr/local/share/powershell1.4
CodeQL, in the tool cache/opt/hostedtoolcache/CodeQL1.4
Miniconda (24.04 only)/usr/share/miniconda1.2
Julia (24.04 only)/usr/local/julia*1.0

The Docker images are pulled in advance for Dependabot and GitHub’s agentic workflows (dependabot-updater-core, gh-aw-firewall and others). On 26.04 they take more room because Docker 29’s containerd store keeps each layer twice, compressed and unpacked.

What each option frees

We ran lumbroso-commons/free-disk-space@v2 with one option on at a time, then with its defaults, then with everything. Space freed on the root disk, and the time the step took:

OptionFreed, 24.04Freed, 26.04Time
android11.8 GB11.9 GB57 to 101 s
dotnet6.7 GB6.7 GB9 to 15 s
preinstalled-runtimes5.6 GB5.6 GB18 to 49 s
large-packages5.0 GB4.8 GB59 to 67 s
haskell3.9 GB3.9 GB2 to 6 s
docker-images2.7 GB3.7 GB9 to 19 s
swap-storage000 to 1 s
dotnet, haskell, docker-images13.4 GB14.4 GB16 to 41 s
The defaults30.2 GB31.0 GB125 to 174 s
Everything35.8 GB36.6 GB216 to 290 s

The sizes were the same in the private and the public repository; the times varied from runner to runner, more than between images.

What stands out:

  • Android is the most room and the slowest. 11.8 GB, but it is a great many small files, and deleting them takes a minute or more.
  • .NET, Haskell and the Docker images are the quick ones. Together about 14 GB in well under a minute: on a private runner, that is room for one more large Docker build.
  • large-packages is slow for what it gives. It removes packages through apt, which takes a minute for 5 GB. The action’s README calls it “the slow one”.
  • swap-storage frees nothing. The action deletes /mnt/swapfile, but on today’s runners the swap file is /swapfile, 3.1 GB, so nothing is deleted. The option still turns swap off, which the action’s README warns can kill a job short on memory. To have the 3 GB, both steps are needed: sudo swapoff -a && sudo rm -f /swapfile freed 3.2 GB in a second. On one public 24.04 runner, swap was in memory (zram) and there was no file to delete.
  • Everything takes four to five minutes. On a private repository’s standard runner, at $0.006 a minute, that is about 3 cents a run, and five minutes of waiting. Freeing more than the job needs costs both.

The quick version, without the action

Three commands, the same room as the three quick options, in 31 seconds on both images:

- name: Free disk space
  run: |
    sudo rm -rf /usr/share/dotnet /usr/local/.ghcup /opt/hostedtoolcache/CodeQL
    docker image prune --all --force

It freed 14.8 GB on 24.04 and 15.8 GB on 26.04. Add /usr/local/lib/android for 11.8 GB more, at a minute or so; a job that builds for Android should keep it, and a job that uses .NET should keep /usr/share/dotnet.

To delete only when needed, check first. The action’s README has a step for it, gated on the free space in the workspace:

- id: disk
  run: echo "free_kib=$(df -k --output=avail -- "$GITHUB_WORKSPACE" | awk 'NR == 2 {print $1}')" >> "$GITHUB_OUTPUT"
- if: ${{ fromJSON(steps.disk.outputs.free_kib) < 20971520 }}  # under 20 GiB
  run: sudo rm -rf /usr/share/dotnet /usr/local/.ghcup /opt/hostedtoolcache/CodeQL

When that is not enough

Deleting tools gives a private runner about 50 GB at most. Past that:

  • Push Docker images instead of loading them, and on Ubuntu 26.04 go back to Docker’s classic store: No space left on device in GitHub Actions has both.
  • Split the job so each part has its own runner and its own disk.
  • Use a runner with a larger disk. GitHub’s 4-CPU larger runner has 150 GB, at $0.012 a minute, and needs a Team or Enterprise Cloud plan.

SuperCI, which we make, runs GitHub Actions jobs on fresh machines in your own AWS, Cloudflare or Modal account. The label says how much disk a job gets, and nothing needs deleting first: on AWS, runs-on: superci/cpu=8/disk=200 gives a job about 180 GB free, for about $0.02 an hour more. Labels and machines has the sizes.

How we measured

A workflow with a matrix of the two images and each option, run on GitHub’s standard runners in a public and a private repository: free space on / from df before and after the step, and the step’s time. Images ubuntu24/20261116 and ubuntu26/20261116. One run of each, so read the times as a range, not a figure.

Related: every GitHub Actions limit in one place.