Repository navigation
fc: add --rootfs-size to grow a microVM's rootfs at create time - #1150
Merged
Merged
Conversation
One small base image can now back microVMs with bigger disks: after the rootfs is copied from the base image, it's sparse-extended to fc.rootfsSizeMib and its ext4 filesystem grown offline (e2fsck -f, then resize2fs). The extension costs no host disk until the guest writes there, and the reflinked base blocks stay shared. A separate, optional RootfsResizer interface like BaseImageIdentifier, but Deploy fails when a size is set and the preparer can't honor it, rather than booting a VM with a smaller disk than asked for. Shrinking below the base image is refused. 0 (default) keeps today's behavior. For boxctl.io's per-size box disks: every box currently gets the base image's 4 GiB regardless of size, which isn't enough for e.g. Rancher. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ngxnc2n5dZEkDj6cR8KhNN
Codecov Reportβ Patch coverage is
Additional details and impacted filesβ View full report in Codecov by Harness. π New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
onctl create --rootfs-size <MiB>(fc.rootfsSizeMib) for Firecracker: after a microVM's rootfs is copied from the base image, it's grown to that size, file and ext4 filesystem both. Default0keeps today's behavior.Motivation: boxctl.io boxes all get the base image's 4 GiB disk regardless of size, so e.g. a Rancher install on a
large(4 vCPU / 16 GiB) box dies on kubelet DiskPressure. With this, boxctl-vms can give each size its own disk from one small base image (companion: cdalar/boxctl-vms#108, which keeps pause/export diffs from shipping the grown tail's zeros).Technical details
DebugfsRootfsPreparer.GrowRootfs: sparsetruncateβe2fsck -f -y(exit 1/2 = corrected, still usable; β₯4 fails) β offlineresize2fs. Costs no host disk until the guest writes; reflinked base blocks stay shared. Refuses to shrink below the base image; same size is a no-op.cloud.RootfsResizerinterface, mirroringBaseImageIdentifierβ but not best-effort:Deployfails and cleans up the VM dir when a size is set and the preparer can't honor it, rather than booting a smaller disk than asked for.Testing
TestDebugfsRootfsPreparer_GrowRootfs_RealExt4runs real e2fsprogs on a real ext4 image and checks the filesystem's block count and a clean fsck. Skipped locally (macOS, no e2fsprogs) β should run on the Linux CI runner.go test ./...passes with a cleanHOME;go vet,gofmt,makeclean. (With a real~/.onctlpresent,TestReadConfig_NoConfigDirectoryandTestCreateFlagsBindToViperfail onmaintoo β they read the home config.)π€ Generated with Claude Code
https://claude.ai/code/session_01Ngxnc2n5dZEkDj6cR8KhNN