fix(partitioning): avoid alignment errors by using fill-gap logic for full space

This commit is contained in:
2026-02-03 20:19:25 +01:00
parent 7371da2451
commit 7a8e8ccbed
2 changed files with 22 additions and 5 deletions

View File

@@ -120,10 +120,13 @@ def create_partition(disk_device, size_mb, type_code="8300", name="Linux filesys
next_num += 1
# Use -g (mbrtogpt) to ensure we can work on the disk if it was MBR
# size_mb=0 means use all available space in the gap
size_spec = f"+{size_mb}M" if size_mb > 0 else "0"
run_command([
"sgdisk",
"-g",
"-n", f"{next_num}:0:+{size_mb}M",
"-n", f"{next_num}:0:{size_spec}",
"-t", f"{next_num}:{type_code}",
"-c", f"{next_num}:{name}",
disk_device