Skip to content

fix(layout): skip the no-op grow when already at max - #343

Merged
jimmykarily merged 1 commit into
masterfrom
fix-broken-partitioning
Sep 24, 2026
Merged

jimmykarily merged 1 commit into
masterfrom
fix-broken-partitioning

Conversation

@jimmykarily

Copy link
Copy Markdown
Collaborator

The idempotent path made ExpandLastPartition succeed when the partition already spanned the rest of the disk, but the function still fell through to ReReadPartitionTable, udevadm trigger and DefaultGrowFsToMax.GrowFSToMax. The last one ephemeral-mounts the partition, calls unshare(CLONE_NEWNS) and mount("/", MS_REC|MS_PRIVATE, ...) on the current namespace, issues EXT4_IOC_RESIZE_FS for a no-op resize, and unmounts. On the rootfs stage inside the initramfs that runs at the same time as the initramfs is laying down the mount tree the rest of the boot depends on, so the two compete and the boot ends up short of the mounts it needs.

Return early once we know there is nothing to do. Already-at-max means the partition table needs no rewrite, so udev has no new event to see, and the filesystem already spans its partition. Downstream is unchanged on the real-expand path.

@jimmykarily

Copy link
Copy Markdown
Collaborator Author

This should fix kairos CI being red.

The idempotent path made ExpandLastPartition succeed when the partition
already spanned the rest of the disk, but the function still fell
through to ReReadPartitionTable, udevadm trigger and
DefaultGrowFsToMax.GrowFSToMax. The last one ephemeral-mounts the
partition, calls unshare(CLONE_NEWNS) and mount("/", MS_REC|MS_PRIVATE,
...) on the current namespace, issues EXT4_IOC_RESIZE_FS for a no-op
resize, and unmounts. This runs on the rootfs stage inside the
initramfs at the same time as the initramfs is laying down the mount
tree the rest of the boot depends on, so the two compete and the boot
ends up short of the mounts it needs.

Return early once we know there is nothing to do. Already-at-max means
the partition table needs no rewrite, so udev has no new event to see,
and the filesystem already spans its partition. Downstream is
unchanged on the real-expand path.

The "Expanding twice" spec pinned the grow count at two, since the
previous behaviour was to still call GrowFSToMax on the second boot.
The no-op path no longer touches the filesystem, so the count is one.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Signed-off-by: Dimitris Karakasilis <dimitris@karakasilis.me>
@jimmykarily
jimmykarily force-pushed the fix-broken-partitioning branch from 185b5df to 4726737 Compare September 24, 2026 08:12
@jimmykarily
jimmykarily merged commit 3c7db49 into master Sep 24, 2026
6 checks passed
@jimmykarily
jimmykarily deleted the fix-broken-partitioning branch September 24, 2026 08:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants