istoreos / istoreos/quickstart

[Feature Request] 建议在写入前增加目标磁盘扇区大小(512 字节 / 4Kn)检测与兼容性告警

Open
#2 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
25
Forks
12
PR merge metrics
No merged PRs in 30d

Description

一、问题背景
在将 iStoreOS 镜像刷入内置 NVMe 固态硬盘时,如果目标盘处于原生 4Kn 模式(逻辑扇区为 4096 字节,而非传统的 512 字节),使用 quickstart 写入会出现严重兼容性问题:

1. 官方镜像分区表与 LBA 偏移是基于 512 字节构建的。直接写入 4Kn 盘时,因物理扇区对齐不匹配,写入可能静默失败,实际全盘数据未真正落盘(全盘依然显示未分配/空白);或者写入后无法通过 UEFI 引导,直接掉入 EFI Shell。
2. 脚本提示写入完成,但实际无法启动。普通用户极难联想到是 4096 扇区导致,容易误判为硬件损坏或镜像损坏,排查成本极高。

二、建议方案
在 quickstart 执行实际写盘前,读取目标设备的扇区大小(例如检查 /sys/block/目标设备/queue/logical_block_size 或使用 blockdev 命令):

1. 若为 512 字节,正常执行写入。
2. 若为 4096 字节(非 512),弹出显眼的兼容性警告,提示用户当前磁盘为 4Kn 原生模式,直接写入会导致引导失败或写入异常。
3. 同时给出处理建议,例如提示用户使用 nvme-cli 工具执行 nvme format 将磁盘 LBA 格式切换为 512 字节后再试。

三、期望效果
在写入最前端拦截 4Kn 物理扇区不匹配导致的写盘假成功与掉引导问题,大幅提升 NVMe 设备的安装成功率,减少不必要的排查负担。

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by locating quickstart's write-to-disk entry point and inspect how the target device is selected before writing. Check /sys/block//queue/logical_block_size or blockdev for the sector size, then verify that 512-byte devices proceed normally while non-512-byte devices receive a clear warning with the nvme-cli format guidance. Done means the check runs before writing and the compatibility warning is covered by an appropriate test or reproducible verification.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, linux
Domain
cli, operating-systems
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.