From 7371da24516f0dcc19c808831c1219f10fa5712a Mon Sep 17 00:00:00 2001 From: N0VA Date: Tue, 3 Feb 2026 20:03:24 +0100 Subject: [PATCH] fix(backend): improve partition creation robustness and formatting --- iridium_installer/backend/disk.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/iridium_installer/backend/disk.py b/iridium_installer/backend/disk.py index c1fe32f..6f5916f 100644 --- a/iridium_installer/backend/disk.py +++ b/iridium_installer/backend/disk.py @@ -119,18 +119,24 @@ def create_partition(disk_device, size_mb, type_code="8300", name="Linux filesys while next_num in existing_nums: next_num += 1 + # Use -g (mbrtogpt) to ensure we can work on the disk if it was MBR run_command([ - "sgdisk", + "sgdisk", + "-g", "-n", f"{next_num}:0:+{size_mb}M", "-t", f"{next_num}:{type_code}", "-c", f"{next_num}:{name}", disk_device ]) + run_command(["partprobe", disk_device]) - # Wait for partition node - import time - time.sleep(1) + # Wait for partition node to appear + try: + run_command(["udevadm", "settle", "--timeout=5"]) + except Exception: + import time + time.sleep(2) part_dev = get_partition_device(disk_device, next_num)