diff --git a/internal/imagepull/ext4.go b/internal/imagepull/ext4.go index 9c31ed5..9c2ef15 100644 --- a/internal/imagepull/ext4.go +++ b/internal/imagepull/ext4.go @@ -5,7 +5,6 @@ import ( "errors" "fmt" "os" - "strconv" "banger/internal/system" ) @@ -53,6 +52,11 @@ func BuildExt4(ctx context.Context, runner system.CommandRunner, srcDir, outFile return err } + // mkfs.ext4's positional `fs-size` is documented in 1 KiB units + // (NOT the filesystem's 4 KiB block size), so dividing by 4096 + // produces a filesystem 1/4 the intended size. Omit the positional + // entirely — the file was truncated to sizeBytes above, and mkfs + // with no fs-size arg uses the whole device. out, runErr := runner.Run(ctx, "mkfs.ext4", "-F", "-q", @@ -60,7 +64,6 @@ func BuildExt4(ctx context.Context, runner system.CommandRunner, srcDir, outFile "-L", "banger-rootfs", "-E", "root_owner=0:0", outFile, - strconv.FormatInt(sizeBytes/4096, 10), // size in 4 KiB blocks ) if runErr != nil { _ = os.Remove(outFile)