Title: GitHub Actions no space left on device: fix it
URL: https://codemany.com/problems/self-hosted-runner-disk-full
Description: GitHub Actions no space left on device? Find what fills the disk, free space safely with Docker and cache cleanup, and stop it coming back on runners.
All pages as Markdown: https://codemany.com/llms.txt

---

[Home](https://codemany.com/) › [Problems](https://codemany.com/problems)

# "No space left on device" in GitHub Actions

"No space left on device" means a job filled the runner's disk. On a hosted runner, delete tools you don't need at the start of the job; on your own runner, prune Docker and old caches, then stop them piling up.

## The short answer

A GitHub Actions "no space left on device" error has two common homes. On GitHub-hosted runners, big builds outgrow the free space. On self-hosted runners, old files pile up over weeks. The fixes differ, so start with the one you use.

## On GitHub-hosted runners

The hosted Linux image ships many SDKs and tools. That leaves limited room for big builds. Delete what you don't use as the first step of the job:

```
- name: Free disk space
  run: |
    df -h /
    sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc
    docker image prune --all --force
    df -h /
```

The two `df` lines show how much you won. Big Docker builds hit this most. If one job still needs more room, split it into two jobs, or use a larger runner.

## On a self-hosted runner

A GitHub Actions runner "no space left on device" error on your own machine means files stayed behind. Your runner keeps what jobs leave. Find the big folders first:

```
df -h
du -sh ~/actions-runner/_work/* | sort -h | tail
docker system df
```

## What fills the disk

- Docker images, volumes and build cache. A GitHub Actions Docker "no space left on device" error is often this.
- Old repo folders under `_work`.
- Tool downloads under `_work/_tool`.
- Package caches, such as `~/.npm`, `~/.gradle` and `~/.cache/pip`.
- On a Mac, Xcode's DerivedData and old simulators.

## Free space safely

1. Wait for jobs to finish
   Don't delete files a running job uses.
2. Prune Docker
   This removes stopped containers, unused images and build cache:
   ```
   docker system prune --all --force
   docker builder prune --all --force
   ```
3. Remove old work folders
   ```
   rm -rf ~/actions-runner/_work/old-repo
   ```
4. Clear Xcode leftovers on a Mac
   ```
   rm -rf ~/Library/Developer/Xcode/DerivedData/*
   xcrun simctl delete unavailable
   ```

After a Docker prune of the build cache, the next build starts colder. For ways to keep layers you want, read [Docker layer caching in GitHub Actions](https://codemany.com/articles/docker-layer-caching-github-actions).

## Stop it happening again

Run a weekly prune with cron. This one keeps anything used in the last 7 days:

```
0 3 * * 0 docker system prune --force --filter "until=168h"
```

Old repo folders are a sign of reused runners. See [dirty workspaces between jobs](https://codemany.com/problems/dirty-workspace-between-jobs).

Codemany does this upkeep for you. Each job's runner folder is wiped after the job. The shared tool cache is pruned past 20 GB, and the [local cache](https://codemany.com/features/local-cache) drops its oldest entries when the disk gets tight. Codemany keeps 20 GB free for the system, and each job needs about 15 GB. When space runs low, a runner waits with "low disk space" instead of starting a job that would fail. [Codemany Console](https://codemany.com/features/fleet-view) shows all your machines in one tab. More in [Troubleshooting](https://codemany.com/docs/troubleshooting).

## Questions

### Why is the disk full on a hosted runner?

The image ships many tools, leaving limited free space for big builds.

### Is docker system prune safe on a runner?

It removes unused images and build cache, so the next build starts colder. Run it when no job is running.

### Does Codemany clean up the disk?

Yes. It wipes each job's folder, caps its caches and keeps 20 GB free for the system. When space runs low, runners wait instead of filling the disk.

## Related

Read next: [dirty workspaces](https://codemany.com/problems/dirty-workspace-between-jobs), [Docker layer caching](https://codemany.com/articles/docker-layer-caching-github-actions), [local cache](https://codemany.com/features/local-cache) and [Troubleshooting](https://codemany.com/docs/troubleshooting).

[Start a 14-day trial](https://codemany.com/docs/get-started) $20 a month for 2 machines. No card needed.
