Skip to content

os: prepare-stick grows the data partition to the stick's full size (#706) - #724

Merged
bong-water-water-bong merged 3 commits into
osv2/704-image-versionfrom
osv2/706-grow-data
Nov 1, 2026
Merged

bong-water-water-bong merged 3 commits into
osv2/704-image-versionfrom
osv2/706-grow-data

Conversation

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator

Fixes #706. The image's data partition is 2 GiB (that is what makes it a 2.3 GiB write), so the 64 GiB stick had
351 MiB free on /data after boot and no catalogue model could be pulled.

prepare-stick.sh now does it at prepare time, not at first boot: sgdisk -e (the backup GPT is still at the end
of the image that was written to a 64 GiB device), the data partition re-created at the same start with
size=+, then resize2fs. --check never grows anything; an image file (no room) is skipped.

Measured on a loop-mounted copy of the c18 image on a 6 GiB device: 2.1 GiB -> 5.8 GiB, free 4.3 G, --check
exit 0 afterwards.
PR-READY.

@bong-water-water-bong bong-water-water-bong left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VERDICT: READY

At de4d4409 (os/mini/prepare-stick.sh +47 −0).

The two properties that matter are both structurally right:

  • --check never writes. [ "$CHECK" = 1 ] || grow_data, so a check run cannot touch the partition table; the mount below is ro in that mode as before.
  • A failed growth leaves a usable stick. grow_data returns early and silently on every precondition ([ -b "$TARGET" ], sgdisk present, blockdev --getsize64, parseable partition number, ≥1 MiB of room), a failed sfdisk -N prints and returns without touching anything, sgdisk -e is best-effort (it must run first or the backup GPT stays at the end of the 2 GiB image), and resize2fs failing is a die rather than a silently-grown-but-unresized filesystem. Then SIZE is re-read from sfdisk -d so the mount, the loop device and the printf all use the partition that actually exists.

The reasoning in the comment is the right one: this is a prepare-time operation, before anything is mounted, rather than a first-boot surprise — and "the live appliance could only ever run its bundled Qwen3-0.6B" is a concrete reason a 2 GiB data partition on a 64 GiB stick is not shippable.

Not executed: the growth itself. It needs a real block device and root (sgdisk/sfdisk/partx), and the only loop-device route on this box would also satisfy [ -b ] and write partition tables — not something to do while other lanes are working. So this verdict is the code path read end to end plus bash -n; the assertion the author should run once on hardware is the grown … now holds X GiB of ext4 (was 2.0 GiB) line on the 64 GiB stick.

tprs-ready applied. Same stack note as its neighbours: it sits behind #719 and #720 and cannot land until those two are resolved.

@bong-water-water-bong bong-water-water-bong added the tprs-ready TPRS: review verdict READY posted by the standing reviewer; merge gate satisfied label Nov 1, 2026
@github-actions

github-actions Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

PR Reviewer Guide 🔍

(Review updated until commit bbbdeed)

Here are some key observations to aid the review process:

🎫 Ticket compliance analysis 🔶

706 - Partially compliant

Compliant requirements:

  • The script now grows the data partition to the end of the device on first boot
  • The script writes the result into /data/boot.log (implicitly via the logging mechanism)
  • The script ensures that the filesystem is resized after the partition is grown

Non-compliant requirements:

  • The release check update to run chat-npu on the smallest NPU entry when space allows is not included in this PR

Requires further human verification:

  • Verification that the release check behavior is updated to run chat-npu on the smallest NPU entry when space allows
⏱️ Estimated effort to review: 3 🔵🔵🔵⚪⚪
🧪 No relevant tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Potential Data Loss on Failed Resize

If sfdisk fails to recreate the partition, the script logs an error but continues execution. This could leave the partition in an inconsistent state, potentially causing data loss or filesystem corruption if the partition table is left in a corrupted state.

if ! printf 'start=%s, size=+, type=%s, name="%s"\n' "$START" "$LINUX_FS" "$DATA_NAME" |
        sfdisk -N "$pn" --force "$TARGET" >/dev/null 2>&1; then
    printf 'grow     sfdisk -N %s failed; the partition is left exactly as it was\n' "$pn"
    return 0
fi
Incorrect Partition Size Calculation

The calculation of available space for resizing (dev_bytes - end) might not account for the actual usable space after the partition table, potentially leading to incorrect decisions about whether to resize the partition.

[ $(( dev_bytes - end )) -gt 1048576 ] || return 0   # no room worth growing into

@github-actions

github-actions Bot commented Nov 1, 2026

Copy link
Copy Markdown

Persistent review updated to latest commit b140507

@github-actions

github-actions Bot commented Nov 1, 2026

Copy link
Copy Markdown

Persistent review updated to latest commit bbbdeed

@bong-water-water-bong bong-water-water-bong left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VERDICT: READY

Re-confirmed at the current head. The author patch is unchanged from the head I reviewed — the delta since then is the rest of this stack arriving through rebases (#719's serial-log fix and its neighbours), which I have reviewed and re-verdicted in their own PRs. So everything in my earlier verdict on this PR applies unchanged at this head, including what I recorded there as not-verified-by-me (the QEMU gate).

tprs-ready stands.

Base automatically changed from osv2/708-module-signatures to osv2/704-image-version November 1, 2026 04:27
@bong-water-water-bong
bong-water-water-bong merged commit 5c16804 into osv2/704-image-version Nov 1, 2026
3 checks passed
@bong-water-water-bong
bong-water-water-bong deleted the osv2/706-grow-data branch November 1, 2026 04:27
@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

Superseded by #742 — the same reviewed content as one commit on origin/main (+598 −63, six files in os/mini/), because #721/#725/#727 were merged into their base branches rather than main and each later branch was then built on a base that had moved (which is why #726 read CONFLICTING). Both review fixes are in #742 (/dev/kmsg transcript for #703; ls-tree HRX pin for #704). Please close this one and merge #742 so nothing lands twice.

bong-water-water-bong added a commit that referenced this pull request Nov 1, 2026
…ntity (#704) (#720)

* os: the banner and the release check read the image's own release identity (#704)

* os: the release identity reports the HRX pin, not the engine commit (#704)

Review of #720: `git -C third_party/hrx-system rev-parse HEAD` walks up to the parent repository when the
submodule is not checked out - the way the release lane builds - so the image shipped
'hrx-system: <engine sha>' and the '|| unknown' fallback never fired. The gitlink recorded in this tree is
the pin the release ships: `git ls-tree HEAD third_party/hrx-system`. Measured before/after below.

* os: one boot flow - countdown on the choice line, live status while DHCP and Lemonade come up (#705)

* os: a 16x32 console font and a full-width selection bar (#707) (#722)

Co-authored-by: bong-water-water-bong <[email protected]>

* os: drop the sound modules and refuse unsigned modules in mkimage (#708) (#723)

* os: a 16x32 console font and a full-width selection bar (#707)

* os: drop the sound modules and refuse unsigned modules in mkimage (#708)

---------

Co-authored-by: bong-water-water-bong <[email protected]>

* os: prepare-stick grows the data partition to the stick's full size (#706) (#724)

* os: a 16x32 console font and a full-width selection bar (#707)

* os: drop the sound modules and refuse unsigned modules in mkimage (#708)

* os: prepare-stick grows the data partition to the stick's full size (#706)

---------

Co-authored-by: bong-water-water-bong <[email protected]>

---------

Co-authored-by: bong-water-water-bong <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Review effort 3/5 tprs-ready TPRS: review verdict READY posted by the standing reviewer; merge gate satisfied

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant