feat: support 4k sector size disk images#13381
Conversation
There was a problem hiding this comment.
Pull request overview
Adds support for building disk images with a configurable sector size (defaulting to 512 bytes), with an emphasis on enabling 4K-native disk image generation for hardware/virtual disks that present 4096-byte sectors. A new metal-4k built-in profile and corresponding e2e CI matrix entry are introduced, the makefs helpers gain a WithSectorSize option propagated through partition formatting, and the installer threads ImageSectorSize through GPT and blkid probe calls when operating in image mode. The bumped go-blockdevice/v2 v2.0.29 supplies the new gpt.WithFileSectorSize/blkid.WithSectorSize APIs being consumed.
Changes:
- Add
Options.SectorSizetomakefswith implementations for XFS (-s size=), VFAT (-S) and ext4 (-b), plus tests. - Thread
ImageSectorSizethroughimagerprofile, install options, GPT file device creation, blkid probes, and partition format options. - Add
metal-4kdefault profile, testdata fixtures for versions 1.9–1.14 on amd64/arm64, and aWITH_4K_DISK_IMAGEe2e CI lane.
Reviewed changes
Copilot reviewed 35 out of 36 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| pkg/makefs/makefs.go | Adds SectorSize to Options and the WithSectorSize option. |
| pkg/makefs/xfs.go | Passes -s size=<N> when sector size is set. |
| pkg/makefs/xfs_test.go | New test asserting XFS sector size honored. |
| pkg/makefs/vfat.go | Passes -S <N> to mkfs.vfat. |
| pkg/makefs/vfat_test.go | New test asserting VFAT sector size via minfo. |
| pkg/makefs/ext4.go | Maps sector size to -b block size for ext4. |
| pkg/makefs/ext4_test.go | New test asserting ext4 block size via tune2fs. |
| internal/pkg/partition/format.go | Adds SectorSize to FormatOptions, forwards to makefs. |
| pkg/imager/profile/output.go | New DiskSectorSize field on ImageOptions. |
| pkg/imager/profile/default.go | New metal-4k default profile. |
| pkg/imager/profile/testdata/metal-4k-*.yaml | Profile-version testdata fixtures for 4K metal images. |
| pkg/imager/out.go | Passes DiskSectorSize to installer options as ImageSectorSize. |
| cmd/installer/pkg/install/install.go | Plumbs ImageSectorSize into blkid probes, GPT file device, and partition options. |
| hack/test/e2e-qemu.sh | Adds WITH_4K_DISK_IMAGE branch invoking make image-metal-4k. |
| .kres.yaml | Adds e2e-disk-image-4k matrix entry. |
| .github/workflows/*.yaml, .github/renovate.json | Regenerated by kres (workflow header bump, action version bumps, label-gated if, new env). |
| go.mod, go.sum | Bumps go-blockdevice/v2 to v2.0.29 for WithSectorSize/WithFileSectorSize. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
There is a broken Canal test, but unrelated to this PR. |
By default, we create still standard 512-bytes sector size images, but optionally sector size can be set to any value. Fixes siderolabs#13227 Signed-off-by: Andrey Smirnov <andrey.smirnov@siderolabs.com>
|
/m |
By default, we create still standard 512-bytes sector size images, but optionally sector size can be set to any value.
Fixes #13227