fix: only export data partition after filesystem setup - #813
Open
mjc wants to merge 1 commit into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds a focused test harness for the S01fs init script and refactors S01fs to support safer/conditional data partition creation, formatting, and mounting with configurable paths for easier testing.
Changes:
- Introduces
tools/test-s01fs-data-disk.shwith stubbed system utilities to validateS01fsdata-partition behavior. - Refactors
kvmapp/system/init.d/S01fsto use overridableNANOKVM_*paths and adds logic to detect empty/unreadable partitions before formatting. - Adds marker-file management around formatting to indicate completion state.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 9 comments.
| File | Description |
|---|---|
| tools/test-s01fs-data-disk.sh | Adds an integration-style shell test runner with stubbed commands and assertions for S01fs. |
| kvmapp/system/init.d/S01fs | Parameterizes device/dir paths and adds partition emptiness detection + conditional mkfs/mount/marker behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
mjc
marked this pull request as draft
June 11, 2026 19:30
mjc
force-pushed
the
mjc/fix-data-partition-format
branch
from
June 11, 2026 21:12
407882a to
dfe19fe
Compare
mjc
marked this pull request as ready for review
June 19, 2026 22:13
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Prevent NanoKVM from mounting or exporting
/dev/mmcblk0p3as the default data disk until the partition setup has actually completed.The old first-boot flow could leave
/etc/kvm.disk0behind even if formatting or mounting failed. On later boots, that stale marker could make NanoKVM treat an unformatted or partially prepared partition as usable, then expose it through USB mass storage or the storage APIs.This change makes the default data-partition state explicit:
/etc/kvm.disk0.formattingand retry it on the next boot./etc/kvm.disk0only after a filesystem is confirmed and the partition mounts successfully./boot/usb.disk0backing files; only the built-in default p3 path is blocked while setup is incomplete.Fixes #76
Fixes #242
Maintainer notes
This is intentionally scoped to the default data partition lifecycle. It avoids auto-formatting unknown non-empty partitions because they may contain user data, while still recovering empty legacy partitions that were previously marked ready.
There is overlap with #814 in
S03usbdev. If that PR lands first, this branch should be rebased so the same readiness gate is applied to the refactored USB gadget setup.Validation
Added focused regression coverage for the data-partition lifecycle:
tools/test-s01fs-data-disk.shcovers first-boot p3 creation, pending-format retries, mkfs/mount failure cleanup, legacy empty-partition recovery, unknown non-empty partition protection, custom backing preservation, and S03 USB mass-storage export gating.server/service/storage/image_test.gocovers storage API readiness checks so explicit/dev/mmcblk0p3mounts are rejected until p3 is ready, while unmounts and custom image paths still work.server/service/vm/virtualdisk/state_test.gocovers VM virtual-disk state so the default data disk is not reported enabled while p3 is missing, pending, or missing its ready marker.Makefileincludes these regressions in the existing test target.