GitHub Actions: Increasing disk space to solve no space left on device error
Published on July 17, 2024 | Written by Andreas
What to do, when GitHub Actions is running out of disk space? The standard GitHub-hosted runner comes with 14 GB storage.1 That’s not a lot of space. The following blog post describes three strategies to solve errors like no space left on device
when running CI/CD jobs.
- Free up to 20 GB on GitHub-hosted runners by deleting unused software
- Use large runners with up to 2040 GB
- Switch to HyperEnv with up to 16 TB
Free up to 20 GB on GitHub-hosted runners by deleting unused software
A GitHub-hosted runner comes with a lot of software pre-installed: Java, Ruby, Node.js, Rust, .NET, Android, to name a few. Most likely, you don’t need most of the installed software. So, you might want to delete some of the pre-installed tools at the beginning of a job.
You could either build your own script to delete unnecessary tools …
sudo rm -rf /usr/share/dotnet
… or use one of the actions available in the GitHub Marketplace.
By deleting unused pre-installed software, it is possible to free up about 20 GB. However, the process is error-prone, as it might cause side effects or break over time due to changes to the pre-installed software.
Use large runners
GitHub provides so-called large runners with advanced capabilities.2 As the following table shows, large runners are available with up to 2040 GB storage. However, keep in mind that a 64-core Linux runner costs $0.256 per minute.
CPU | Storage (SSD) | Costs per minute (Linux) |
---|---|---|
2 | 75 GB | $0.008 |
4 | 150 GB | $0.016 |
8 | 300 GB | $0.032 |
16 | 600 GB | $0.064 |
32 | 1200 GB | $0.128 |
64 | 2040 GB | $0.256 |
Also, please note that larger runners are only available for organizations and enterprises using the GitHub Team or GitHub Enterprise Cloud plans.
In summary, large runners are expensive when used to increase disk space.
Switch to HyperEnv
HyperEnv enables you to deploy self-hosted GitHub runners on AWS with ease. The configuration parameter VolumeSize
allows you to adapt the disk size for the GitHub runners to your needs. The maximum is 16 TB and AWS charges about $0.000002 per GB and minute.
Moreover, you are flexible when choosing CPU and memory for the runner, no need to increase the size of the virtual machine, when all you need is more than 14 GB disk space.
How does HyperEnv work? Our solution automatically deploys the following architecture to your AWS account.
- An API Gateway, Lambda functions, and an SQS queue deployed to your AWS account launch EC2 instances on-demand to execute GitHub jobs.
- The private GitHub app grants HyperEnv access to register runners and receive webhook events.
The following steps happen for each GitHub Actions job running on HyperEnv:
- GitHub sends webhook event whenever a new job gets created.
- HyperEnv launches an EC2 instance with GitHub runner and build environments pre-installed.
- The GitHub runner executes the job.
- The EC2 instance terminates.
Did I mention, that HyperEnv is cheaper than GitHub-hosted runners already?3
So what are you waiting for? Get started with HyperEnv!