clawdie-iso/skills/iso-build-cleanup/SKILL.md
Sam & Claude f3f47c8cdd docs/skills: switch published image + flashing from .gz to .xz
Smaller downloads that Rufus/balenaEtcher/RPi-Imager still read directly (zstd
would break Windows flashers). Switches the image artifact, flashing commands
(xz -dc | dd, xz -t, unxz), publish flow (xz -T0 -c), the artifact-manifest
script, and all skills + docs to .img.xz. Adds a Windows (Rufus/Etcher) flashing
section + README pointer. Source tarballs (clawdie-ai *.tar.gz) unchanged.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-14 12:04:56 +02:00

3.6 KiB

name description
iso-build-cleanup Recover disk space and reset the repo-local Clawdie ISO build workspace after an interrupted or failed FreeBSD build by inspecting tmp/output and tmp/cache, unmounting tmp/cache/mnt, detaching stale md devices, and removing safe-to-delete artifacts such as work.img and old output images while preserving useful caches for the next build.

iso-build-cleanup

Use this skill when the ISO build was interrupted, disk space is low, or the repo still has stale build state under tmp/. Run one command at a time and inspect before deleting or detaching anything.

Workspace names

Use clear language while keeping the real paths:

  • tmp/output = output image artifacts
  • tmp/cache = build cache
  • tmp/cache/mnt = mounted work image; ISO-builder-specific mountpoint
  • tmp/cache/work.img = reusable work image

Do not mount unrelated datasets, recovery filesystems, or scratch filesystems elsewhere under repo tmp/.

1. Inspect space before deleting anything

Run from the repo root:

df -h /home/clawdie /
du -xh -d 2 tmp | sort -h | tail -n 40
ls -lh tmp/output
du -xh -d 1 tmp/cache | sort -h
ls -lah tmp/cache | sort -k5 -h | tail -n 30
find tmp/cache -maxdepth 1 -type f -ls
/sbin/mount | grep /home/clawdie/ai/clawdie-iso/tmp/cache/mnt

This tells you whether the space is in:

  • old output artifacts
  • work.img
  • memstick slice extracts like memstick-s2.img
  • still-mounted build filesystems

2. Unmount the mounted work image if present

Only run the unmounts that still exist:

sudo /sbin/umount /home/clawdie/ai/clawdie-iso/tmp/cache/mnt/proc
sudo /sbin/umount /home/clawdie/ai/clawdie-iso/tmp/cache/mnt/dev
sudo /sbin/umount /home/clawdie/ai/clawdie-iso/tmp/cache/mnt

If one of these says “not mounted”, continue.

3. Find and detach stale md devices

Inspect:

sudo /sbin/mdconfig -l
sudo /sbin/mdconfig -lv

Typical stuck state looks like:

md0  vnode  28G  /home/clawdie/ai/clawdie-iso/tmp/cache/work.img
md1  vnode  28G  /home/clawdie/ai/clawdie-iso/tmp/cache/work.img

Detach the stale devices:

sudo /sbin/mdconfig -d -u md0
sudo /sbin/mdconfig -d -u md1

If the unit numbers differ, detach the ones pointing at tmp/cache/work.img.

4. Remove stale build-state files

Clear the work-image marker and the work image itself:

sudo rm -f /home/clawdie/ai/clawdie-iso/tmp/cache/.md_device
sudo rm -f /home/clawdie/ai/clawdie-iso/tmp/cache/work.img

5. Safe delete list

These are safe to delete when you need space, but confirm with the operator before removing the newest commit-suffixed .img.xz artifact if it may be the current test image:

sudo rm -f /home/clawdie/ai/clawdie-iso/tmp/output/*.img
sudo rm -f /home/clawdie/ai/clawdie-iso/tmp/output/*.img.xz
sudo rm -f /home/clawdie/ai/clawdie-iso/tmp/output/*.sha256
sudo rm -f /home/clawdie/ai/clawdie-iso/tmp/cache/memstick-s2.img
sudo rm -f /home/clawdie/ai/clawdie-iso/tmp/cache/memstick-s2a.img

Keep these if you want the next build to reuse caches:

  • tmp/cache/FreeBSD-15.0-RELEASE-amd64-memstick.img
  • tmp/cache/FreeBSD-15.0-RELEASE-amd64-memstick.img.SHA256
  • tmp/packages/
  • tmp/npm-globals/

6. Verify reclaimed space

Recheck:

df -h /home/clawdie /
du -xh -d 1 tmp/cache | sort -h
ls -lh tmp/output

If cleanup worked, tmp/output should be empty or much smaller, work.img should be gone, and free space on /home/clawdie should jump significantly.

7. What to do next

After cleanup:

  • if memstick cache is still present and healthy, rebuild with: sudo ./build.sh --skip-memstick-fetch
  • if the memstick cache is gone or suspect, rebuild with: sudo ./build.sh