From b39e3dc88637732df5356cf503436531cccd24d8 Mon Sep 17 00:00:00 2001 From: codefiles <11915375+codefiles@users.noreply.github.com> Date: Thu, 7 Mar 2024 07:49:14 -0500 Subject: Fix partition table commit (#2294) --- archinstall/lib/disk/device_handler.py | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'archinstall/lib/disk') diff --git a/archinstall/lib/disk/device_handler.py b/archinstall/lib/disk/device_handler.py index fcf52013..5b97f25d 100644 --- a/archinstall/lib/disk/device_handler.py +++ b/archinstall/lib/disk/device_handler.py @@ -322,7 +322,7 @@ class DeviceHandler(object): part_mod.partuuid = lsblk_info.partuuid part_mod.uuid = lsblk_info.uuid - def _perform_partitioning( + def _setup_partition( self, part_mod: PartitionModification, block_device: BDevice, @@ -339,7 +339,6 @@ class DeviceHandler(object): raise DiskError(f'No partition for dev path found: {part_mod.safe_dev_path}') disk.deletePartition(part_info.partition) - disk.commit() if part_mod.status == ModificationStatus.Delete: return @@ -378,16 +377,12 @@ class DeviceHandler(object): try: disk.addPartition(partition=partition, constraint=disk.device.optimalAlignedConstraint) - disk.commit() - - # the creation will take a bit of time - time.sleep(3) - - # the partition has a real path now as it was created - part_mod.dev_path = Path(partition.path) except PartitionException as ex: raise DiskError(f'Unable to add partition, most likely due to overlapping sectors: {ex}') from ex + # the partition has a path now that it has been added + part_mod.dev_path = Path(partition.path) + def _fetch_part_info(self, path: Path) -> LsblkInfo: attempts = 3 lsblk_info: Optional[LsblkInfo] = None @@ -535,7 +530,9 @@ class DeviceHandler(object): # if the entire disk got nuked then we don't have to delete # any existing partitions anymore because they're all gone already requires_delete = modification.wipe is False - self._perform_partitioning(part_mod, modification.device, disk, requires_delete=requires_delete) + self._setup_partition(part_mod, modification.device, disk, requires_delete=requires_delete) + + disk.commit() def mount( self, -- cgit v1.2.3-54-g00ecf