banger/internal/system
Thales Maciel a3a51e06c4
daemon: build the work disk fresh instead of cloning the seed file
Old flow on every 'banger vm run' that hit the seeded path:
CopyFilePreferClone the seed file (FICLONE attempt + io.Copy + fsync
fallback), then e2fsck -fp + resize2fs to grow the FS to the spec
size. On filesystems without reflink support that meant pushing
512+ MiB through the kernel followed by a full filesystem check
and resize, even though the seed only carries a few KB of dotfiles
— minWorkSeedBytes is 512 MiB but the actual payload is tiny.
That is the minute-long stall on the 'cloning work seed' stage
users see today.

Replace the copy with a sized fresh ext4: truncate to
WorkDiskSizeBytes, mkfs.ext4 -F -E root_owner=0:0, debugfs rdump
to extract the seed's contents, then ingest each file via the
sudoless ext4 toolkit (MkdirExt4 / WriteExt4FileOwned, root:root,
mode preserved). Sub-second regardless of seed size or requested
work-disk size; no fsck or resize needed because the FS is created
at its final size from the start.

Also drop the now-implementation-pinned
TestEnsureWorkDiskClonesSeedImageAndResizes — its premise (a
scripted e2fsck/resize2fs sequence) no longer reflects the code,
and smoke covers the new flow end to end. Stage label changed
from 'cloning work seed' to 'applying work seed' to match what
actually happens.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-26 20:42:10 -03:00
..
ext4.go daemon: rewrite git identity sync + file_sync on ext4 toolkit 2026-04-23 18:29:30 -03:00
ext4_test.go daemon: rewrite ensureWorkDisk no-seed path to skip the mount + cp 2026-04-23 18:09:32 -03:00
extra_test.go coverage: easy-wins batch across cli, system, paths, vmdns, toolingplan 2026-04-18 17:57:05 -03:00
files.go daemon: build the work disk fresh instead of cloning the seed file 2026-04-26 20:42:10 -03:00
preflight.go Refactor VM lifecycle around capabilities 2026-03-18 19:28:26 -03:00
report.go Refactor VM lifecycle around capabilities 2026-03-18 19:28:26 -03:00
report_test.go Refactor VM lifecycle around capabilities 2026-03-18 19:28:26 -03:00
system.go daemon: split owner daemon from root helper 2026-04-26 12:43:17 -03:00
system_test.go Stop using kernel IP autoconfig for runtime VMs 2026-03-21 21:54:18 -03:00