Page MenuHomeFreeBSD

EC2: Align partitions to 1 MB boundaries
AcceptedPublic

Authored by cperciva on Thu, Oct 8, 1:02 AM.

Details

Reviewers
jlduran
Summary

MFC after: 2 months
Sponsored by: Amazon

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 77831
Build 74714: arc lint + arc unit

Event Timeline

jlduran added a subscriber: jlduran.

Thank you!
I remember mentioning this to the GSoC 2026 participant. All vmimages should do this as well IMO.
Currently only Azure images do it (by setting VM_BOOTPARTSOFFSET).

This revision is now accepted and ready to land.Thu, Oct 8, 1:35 AM

Thank you!
I remember mentioning this to the GSoC 2026 participant.

Which project was that?

All vmimages should do this as well IMO.

We could make 1 MB alignment the default across all VM images. I'd want to confer with other cloud vendors first though.

Currently only Azure images do it (by setting VM_BOOTPARTSOFFSET).

As I understand it, VM_BOOTPARTSOFFSET is just for setting the offset of the gpt boot file, so even with that enabled on Azure the other partitions aren't necessarily aligned.

Thank you!
I remember mentioning this to the GSoC 2026 participant.

Which project was that?

It was the NanoBSD Reimagined project (paused until December).
The particular revision that touches partition alignment is D58964, there is a calculate_partitioning function that generates a gpart backup-compatible output, that is then consumed by create_diskimage's mkimg(1) to "manually" align the partitions. The changes you are proposing in D60450 might simplify this procedure, although, for NanoBSD I prefer the current approach because it is very explicit.

All vmimages should do this as well IMO.

We could make 1 MB alignment the default across all VM images. I'd want to confer with other cloud vendors first though.

The GSoC participant downloaded an aarch64 (ZFS) VM image (https://download.freebsd.org/snapshots/VM-IMAGES/16.0-CURRENT/aarch64/Latest/) that was also unaligned.

Currently only Azure images do it (by setting VM_BOOTPARTSOFFSET).

As I understand it, VM_BOOTPARTSOFFSET is just for setting the offset of the gpt boot file, so even with that enabled on Azure the other partitions aren't necessarily aligned.

Yes. But it is very likely that everything else will, as sizes are usually in multiples of 1MiB and the partitions are kept contiguous.
I remember complaining that every time I spawn an "official" FreeBSD AWS image, I end up re-creating the root disk because the partitions were not 1MiB-aligned, which defeats the purpose of using an official image.