perf(convert): reduce rootfs copies from 3 to 1#110
Conversation
|
@imlk0 ,您好,您的请求已接收,请耐心等待结果。 |
|
@imlk0 ,您好,未检测到有镜像需要构建,如需重新检测请评论 /start 。 |
|
@imlk0 ,您好,您的请求已接收,请耐心等待结果。 |
|
@imlk0 ,您好,未检测到有镜像需要构建,如需重新检测请评论 /start 。 |
|
@imlk0 ,您好,您的请求已接收,请耐心等待结果。 |
|
@imlk0 ,您好,未检测到有镜像需要构建,如需重新检测请评论 /start 。 |
|
@imlk0 ,您好,您的请求已接收,请耐心等待结果。 |
|
@imlk0 ,您好,未检测到有镜像需要构建,如需重新检测请评论 /start 。 |
|
@imlk0 ,您好,您的请求已接收,请耐心等待结果。 |
|
@imlk0 ,您好,未检测到有镜像需要构建,如需重新检测请评论 /start 。 |
|
@imlk0 ,您好,您的请求已接收,请耐心等待结果。 |
|
@imlk0 ,您好,未检测到有镜像需要构建,如需重新检测请评论 /start 。 |
|
@imlk0 ,您好,您的请求已接收,请耐心等待结果。 |
|
@imlk0 ,您好,未检测到有镜像需要构建,如需重新检测请评论 /start 。 |
|
@imlk0 ,您好,您的请求已接收,请耐心等待结果。 |
|
@imlk0 ,您好,未检测到有镜像需要构建,如需重新检测请评论 /start 。 |
|
@imlk0 ,您好,您的请求已接收,请耐心等待结果。 |
|
@imlk0 ,您好,未检测到有镜像需要构建,如需重新检测请评论 /start 。 |
|
@imlk0 ,您好,您的请求已接收,请耐心等待结果。 |
|
@imlk0 ,您好,未检测到有镜像需要构建,如需重新检测请评论 /start 。 |
|
@imlk0 ,您好,您的请求已接收,请耐心等待结果。 |
|
@imlk0 ,您好,未检测到有镜像需要构建,如需重新检测请评论 /start 。 |
|
@imlk0 ,您好,您的请求已接收,请耐心等待结果。 |
|
@imlk0 ,您好,未检测到有镜像需要构建,如需重新检测请评论 /start 。 |
|
@imlk0 ,您好,您的请求已接收,请耐心等待结果。 |
|
@imlk0 ,您好,未检测到有镜像需要构建,如需重新检测请评论 /start 。 |
…napshots Replace the intermediate rootfs.img file and final qemu-img convert step with qcow2 overlay/snapshot architecture. The source image is modified through a writable overlay (source-mod), then forked into two independent snapshots (source-read for verity hash, source-write for dracut). This eliminates two full rootfs copies (~17s dd + ~32s qemu-img convert). Additional fixes: - Fix RPM version detection: rpm -q outputs error to stdout on uninstalled packages, which was captured as the version string - Fix unbound boot_part variable when source has no separate boot partition
Deprecate in-place device conversion in favor of file-based (--in/--out) conversion only. All device-mode code paths and conditional branches are removed, simplifying the codebase. Changes: - Remove operate_on_device variable and all conditional branches - Remove device-mode validation, confirmation prompt, and cleanup logic - Keep --device/-d flag but emit a deprecation warning - Remove --wipe-freed-space option (emit deprecation warning if used) - Update help text to reflect deprecation - Update docs: quick-start.md, quick-start_zh.md — replace --device examples with --in/--out and add deprecation notes (since v0.7.0)
Remove "Example 5: Encrypt a Real System Disk" section which duplicated Example 1 after the --device removal. Renumber remaining examples (4: KBS, 5: KMS). Update prerequisites and troubleshooting to remove real-disk mentions. Add deprecation note at the top of both quick-start docs.
Replace ~70 lines of duplicated mount/unmount code with a single call to setup_chroot_mounts, adding optional boot_override_part and efi_override_part parameters to handle the update_initrd's output-device mount needs.
- Add function-level shellcheck disable=SC2154 on step:update_initrd and step::prepare_output_and_snapshots (variables set in main() and used in these step functions) - Remove unused output_boot_part_num variable - Remove duplicate log::step from step::prepare_output_and_snapshots and step::copy_partitions (main() already logs the step)
Use guestfish to write EFI content directly to qcow2 file, bypassing the NBD kernel page cache invalidation issue that caused FAT32 filesystem data to be lost on qemu-nbd disconnect. Also fix EFI partition detection in external.rs where the lsblk FSTYPE column addition broke the partition filter, and add partprobe to ensure partition device nodes are created after NBD connect.
- Remove early mkfs.vfat + mount + cp for EFI partition in UKI mode; EFI is now dd'd in copy_partitions and restored via guestfish after NBD disconnect to avoid writeback-cache data loss. - Save partition UUIDs with blkid before parted rm/mkpart operations, restore them with sgdisk -u afterward to preserve GPT GUIDs.
When the source has no separate boot partition, dracut generates grub.cfg inside boot.img but copy_partitions only copied vmlinuz files, leaving grub.cfg and grubenv missing from the output boot partition. Now copies all boot content and sets the output boot partition's filesystem UUID (via e2fsck + tune2fs -U) to match boot.img's UUID, so that grub.cfg references point to the correct partition.
Check the guest boot log for "cryptpilot-fde-guest" to confirm the RPM was actually installed and the service ran during boot.
|
@imlk0 ,您好,您的请求已接收,请耐心等待结果。 |
|
@imlk0 ,您好,未检测到有镜像需要构建,如需重新检测请评论 /start 。 |
Summary
rootfs.imgfile and finalqemu-img convertstep with a qcow2 overlay/snapshot architecture, reducing full rootfs copies from 3 → 1source-mod), then forked into two independent snapshots (source-readfor verity hash,source-writefor dracut initrd generation)--device/operate_on_devicesupport: deprecate in-place device conversion in favor of file-based (--in/--out) onlyrpm -qoutputs error to stdout on uninstalled packages, which was captured as the version stringboot_partvariable when source has no separate boot partition--wipe-freed-spaceoption (no longer needed with qcow2 overlay architecture)Test plan