From bee487653a7dcff53f4ef1b91f4386c929c676c8 Mon Sep 17 00:00:00 2001 From: Tj Date: Tue, 2 Jul 2024 21:49:00 +0100 Subject: [PATCH] Adjust last usable sector for GPT --- src/modules/partition/core/PartitionActions.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/modules/partition/core/PartitionActions.cpp b/src/modules/partition/core/PartitionActions.cpp index b5fb0cafb..4ec9653db 100644 --- a/src/modules/partition/core/PartitionActions.cpp +++ b/src/modules/partition/core/PartitionActions.cpp @@ -107,6 +107,8 @@ doAutopartition( PartitionCoreModule* core, Device* dev, Choices::AutoPartitionO { partType = isEfi ? PartitionTable::gpt : PartitionTable::msdos; } + // last usable sector possibly allowing for secondary GPT using 66 sectors (256 entries) + qint64 lastSectorForRoot = dev->totalLogical() - (partType == PartitionTable::gpt ? 67 : 1); // Looking up the defaultFsType (which should name a filesystem type) // will log an error and set the type to Unknown if there's something wrong. @@ -163,7 +165,6 @@ doAutopartition( PartitionCoreModule* core, Device* dev, Choices::AutoPartitionO shouldCreateSwap = availableSpaceB > requiredSpaceB; } - qint64 lastSectorForRoot = dev->totalLogical() - 1; //last sector of the device if ( shouldCreateSwap ) { lastSectorForRoot -= suggestedSwapSizeB / sectorSize + 1;