Merge pull request #2351 from iam-TJ/fix-gpt-partition-sectors

Adjust last usable sector for GPT
This commit is contained in:
Adriaan de Groot 2024-07-03 00:07:14 +02:00 committed by GitHub
commit 2023298764
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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;