| name | disk-usage |
| description | Audit and reduce disk usage on Linux/exe.dev/Toolnix hosts. Use when the user asks about disk pressure, billing-related disk usage, Nix store size, garbage collection, top disk consumers, or commands like disk-cleanup-nix. Provides SOPs and scripts for safe Nix cleanup, profile generation expiry, cache cleanup, and before/after disk reports across fleets. |
Disk Usage
Use this skill for disk-pressure or disk-billing work on Linux hosts, especially
Toolnix-managed exe.dev VMs.
Default workflow
- Capture a before snapshot:
df -h / /nix 2>/dev/null || df -h /
du -sh /nix/store 2>/dev/null || true
- top-level
du -x report when diagnosing large hosts.
- Run the safe Nix cleanup SOP from
references/disk-cleanup-nix.md.
- Capture an after snapshot.
- For fleets, tabulate host, used, available, percent, and major consumers.
- If machine state changed, update operational logs in the relevant inventory.
Script
Use scripts/disk-cleanup-nix.sh for the standard safe cleanup. It avoids
removing project checkouts, .devenv directories, or language caches by default.
scripts/disk-cleanup-nix.sh
To remove project .devenv directories that contain GC roots after confirming
that dev shell state is disposable:
scripts/disk-cleanup-nix.sh --clean-devenv
For a deeper audit after cleanup:
df -h / /nix 2>/dev/null || df -h /
sudo du -xBG -d1 / 2>/dev/null | sort -nr | head -20
du -xBG -d2 "$HOME" 2>/dev/null | sort -nr | head -25
sudo du -xBG -d2 /var 2>/dev/null | sort -nr | head -25
sudo du -xBG -d2 /nix 2>/dev/null | sort -nr | head -25
Gotchas
nix store gc only removes paths not reachable from GC roots.
- Old Nix profile generations, Home Manager generations, system profiles, and
project
.devenv/gc roots can keep outdated packages alive.
nix-collect-garbage -d is not enough if profile histories/generations still
root old closures.
- Do not delete project
.devenv, language caches, Docker volumes, or app data
without confirming they are disposable for that host.
- On exe.dev, check current docs/billing semantics. Recent observed billing was
based on actual used disk across fleet, not only allocated disk capacity.
- To avoid duplicate
pi / claude-code closures, keep operator tools in Home
Manager and avoid also pinning them in project devenv shells. If devenv is
not actively used on a VM, skipping it avoids .devenv/gc roots entirely.