Limits on resizing disk storage for an existing GitHub Codespace
0 reputation · 04 Apr 2020, 03:39 UTC
0 reputation · 04 Apr 2020, 03:39 UTC
I want a repeatable development environment using a committed devcontainer.json, and I need to understand the limits around persistent disk capacity for a Codespace that already exists. Specifically, I want to know whether storage can be increased in place, or whether the only supported path is selecting machine and storage size at creation time and rebuilding afterward.
The repository configuration is fully reproducible: image, features, extensions, and postCreateCommand all come from the committed file. What is not reproducible is uncommitted local state, so deleting and recreating a Codespace means losing anything outside the repository. Available machine types and storage options also appear to depend on the plan and organization policy, which makes it hard to state a universal default disk size.
Assume current GitHub Codespaces behavior as of late 2026; exact limits are plan-sensitive and should be verified rather than assumed.
df -h inside the Codespace, is there a reliable way to confirm actual disk, CPU, and memory before choosing a machine type?34775 reputation · 04 Apr 2020, 07:46 UTC
1. Can the disk of an existing Codespace be resized without deleting it?
As of late 2026, GitHub Codespaces does not provide an in‑place resize operation for the persistent volume of an active Codespace. The only supported path is to delete the Codespace and create a new one with the desired disk size specified at creation time. No rebuild or restart is required beyond the recreation itself.
2. When recreating from the same commit, is there any supported way to retain data stored outside the repository working tree?
The persistent volume is bound to the Codespace’s lifecycle. Re‑creating a Codespace from the same commit drops all files that were not committed to the repository. To keep data across recreations you must store it outside the Codespace volume, for example by mounting an external persistent volume (GitHub Actions cache, cloud object store, or a network share) in devcontainer.json.
3. Besides df -h inside the Codespace, is there a reliable way to confirm actual disk, CPU, and memory before choosing a machine type?
df -h shows the size of the persistent volume attached to the running container.
cat /proc/meminfo | grep MemTotal displays the total RAM allocated to the container.
lscpu | grep "CPU(s)" lists the number of virtual CPUs assigned.
The GitHub UI (Codespaces page → Settings → Quotas) lists the maximum disk, CPU, and memory available for each machine type on your current plan.
The REST API endpoint /machines (e.g., GET https://api.github.com/orgs/{org}/codespaces/machines) returns a JSON array of supported machine types, each including disk_size_gb, cpu_count, and memory_gb. This is the most reliable source for plan‑specific limits.
/machines API.--disk-size flag if you use the CLI.df -h inside the Codespace.devcontainer.json before recreating.Could you let me know which GitHub plan or organization Codespaces quota you’re currently on? Knowing the exact quota can refine the recommended maximum disk size and help verify that the UI’s suggested limits match the API response.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.