fix(storage): gate default data disk until filesystem is ready - #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
mjc
force-pushed
the
mjc/fix-data-partition-format
branch
2 times, most recently
from
August 6, 2026 18:45
03745a4 to
1f4dfc6
Compare
Author
|
rebased on main |
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.中文说明
修复 NanoKVM 在数据分区文件系统准备完成前,将
/dev/mmcblk0p3当作可用磁盘的问题。旧的首次启动流程可能在格式化或挂载失败后留下
/etc/kvm.disk0。后续启动时,NanoKVM 可能误认为数据分区已经准备完成,并通过 USB 大容量存储、存储 API 或虚拟磁盘 API 暴露未格式化或未完整初始化的分区。这个 PR:
/etc/kvm.disk0.formatting记录中断的格式化流程,并在下次启动时重试。/etc/kvm.disk0。/boot/usb.disk0文件,不会因为默认分区尚未准备好而阻止自定义镜像。Branch-added tests
tools/test-s01fs-data-disk.shruns 28 isolated shell cases. The S01fs cases exercise creation and formatting of a missing p3, retry state across delayed devices and mkfs failures, marker cleanup after mount failures, reuse of valid filesystems, cautious handling of unknown or zero-filled partitions, and the distinction between the default partition and custom backing files. Its S03 cases exercise both the readiness resolver and the generated configfs mass-storage function, including pending, missing-marker, missing-device, whitespace, and custom-image paths.server/service/storage/image_test.gochecks default-partition path resolution, verifies that an unready p3 request is rejected before changing configfs state, and verifies that an empty request can still clear the current image while p3 is unavailable.server/service/vm/virtualdisk/state_test.gochecks when the virtual disk is reported configured for default and custom backing paths, then checks that command selection mounts only an unconfigured disk and otherwise unmounts it.make testruns the shell suite plus both Go packages.