agentleFS
th3r-devth3r-dev/th3-skills/skills/podman-disk-reclaim/SKILL.md

podman-disk-reclaim

Skill0 starsChanged 31 days agoMITView on GitHub

Use this skill when Podman eats too much disk on Windows, macOS, or Linux. Triggers include "podman storage too big", a Podman machine disk or ext4.vhdx that keeps growing, a drive filling up, too many container images, or any request to prune, clean up, shrink, or compact Podman. One cross-platform Python script prunes unused images (stopped containers and volumes only on request), runs fstrim inside the Podman machine, and on Windows compacts the WSL vhdx with diskpart so the space actually returns to the host. Pruning alone does NOT shrink a WSL vhdx; this skill handles every step.

The file

We split this skill into the rules it gives an agent

1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Test: python tests/test_reclaim.py or pytest tests.

    line 68

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Podman Disk Reclaim

scripts/reclaim.py uses only the Python standard library (3.9+). What it does depends on the OS:

OSWhere Podman storage livesSteps the script runs
LinuxHost filesystem, native Podmanprune
macOSPodman machine, sparse raw diskprune, fstrim in the machine
WindowsPodman machine, WSL2 ext4.vhdxprune, fstrim, stop, wsl --shutdown, diskpart compact, start

On Windows, the WSL vhdx grows but never shrinks. podman system prune frees space inside the VM, but the host file stays the same size until it is compacted.

Workflow

1. Measure first (always)

python scripts/reclaim.py --dry-run

This prints podman system df, the vhdx size on the host (Windows only), and the planned steps. It changes nothing. Read the output:

  • The vhdx is much bigger than the in-use SIZE. Compaction alone recovers most of the space. Suggest --skip-prune if the user wants to keep every image.
  • RECLAIMABLE is high on Images. A default run is the right call.

2. Confirm before deleting

Pruning images is destructive. Public images are cheap to pull again, but locally built ones are not. Before a real run, show the user what will be removed and get a yes. Ask separately before using either of these flags:

  • --containers removes stopped containers along with their writable layers. A stopped dev database is one example of what this deletes.
  • --volumes removes volumes that no container references. If you combine it with --containers, it also removes the volumes of the containers that were just pruned. That is data loss.

3. Windows: run elevated

diskpart needs Administrator rights. If the current shell is not elevated, give the user the exact command to run in an Administrator terminal:

python <repo>\skills\podman-disk-reclaim\scripts\reclaim.py

Warn the user that the script calls wsl --shutdown. That stops every WSL distro (Ubuntu, Docker Desktop, and others), not just Podman. If they do not want that, --skip-compact prunes without admin rights, but the host file stays the same size.

4. Report

Report the before and after output of podman system df. On Windows, also report the final line: VHDX on host: X GB -> Y GB (freed Z GB).

Flags

FlagEffect
--dry-runShow sizes and the plan, change nothing
--skip-pruneReclaim only, delete nothing
--skip-compactPrune only. No admin rights needed, no wsl --shutdown
--containersAlso prune stopped containers
--volumesAlso prune unused volumes
--machine <name>Target a machine other than podman-machine-default

Notes

  • Do not recreate the machine with a smaller --disk-size to save space. The disk size is a cap, not space that is already allocated.
  • Windows support covers the WSL machine provider only. A Hyper-V provider machine fails with "WSL distro not found".
  • On Windows Home, Optimize-VHD is missing because there is no Hyper-V module. diskpart ships with every edition, which is why the script uses it.
  • Test: python tests/test_reclaim.py or pytest tests.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.