Repository navigation
Replies: 2 comments 1 reply
|
I have almost no prior knowledge of raw disk images, GPT, or APFS internals. After I encountered this issue, Codex helped me diagnose and repair the disk image. I hope the technical details are useful to the developers. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
1. Context
This issue occurred while resizing an existing macOS VM after the disk-resize feature from PR #678 was released.
The VM was originally installed from an Apple restore image.
2. Problem details and evidence
VirtualBuddy enlarged the raw image file, but did not update the GPT partition layout or APFS container.
Show read-only diagnostic commands
I then attached the image read-only to inspect the partition map and APFS container:
The result was:
The added space appeared after Recovery:
Running the suggested command inside the guest, using the correct disk identifier, failed:
Error:
The primary GPT header and partition entries contained:
GPTLayoutAdjustercurrently requires:In this Apple-created layout:
The geometry check therefore returns without moving Recovery or extending the main partition.
The backing file is still enlarged and
resizePendingis cleared, so the partial resize appears successful.3. Approach taken
I stopped VirtualBuddy and worked on an APFS clone of the image.
I used a one-off Swift helper based on
GPTLayoutAdjusterto validate the GPT, preserve the 7-sector trailing gap, move Recovery, extend the main APFS partition entry, and rebuild both GPT structures.Show GPT repair commands
After the GPT repair, the physical-store partition was 119,734,796,288 bytes while the APFS container ceiling was still 62,826,479,616 bytes.
A direct grow-to-fit still returned
-69519. A 16 MiB shrink/grow nudge forced APFS to refresh its capacity.Show APFS resize and verification commands
Final verified state:
Only after these checks passed did I replace the affected image with the verified clone. The original VM had already been backed up.
4. Suggestions
recoveryLastandlastUsableLBA.resizePending.All reactions