Merge pull request #2392 from jpetso/work/jpetso/fix-2367
[partition] Use the same last sector for root vs. swap partitions
This commit is contained in:
commit
72e3945d09
@ -108,7 +108,7 @@ doAutopartition( PartitionCoreModule* core, Device* dev, Choices::AutoPartitionO
|
|||||||
partType = isEfi ? PartitionTable::gpt : PartitionTable::msdos;
|
partType = isEfi ? PartitionTable::gpt : PartitionTable::msdos;
|
||||||
}
|
}
|
||||||
// last usable sector possibly allowing for secondary GPT using 66 sectors (256 entries)
|
// last usable sector possibly allowing for secondary GPT using 66 sectors (256 entries)
|
||||||
qint64 lastSectorForRoot = dev->totalLogical() - (partType == PartitionTable::gpt ? 67 : 1);
|
const qint64 lastUsableSector = dev->totalLogical() - ( partType == PartitionTable::gpt ? 67 : 1 );
|
||||||
|
|
||||||
// Looking up the defaultFsType (which should name a filesystem type)
|
// 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.
|
// will log an error and set the type to Unknown if there's something wrong.
|
||||||
@ -154,7 +154,7 @@ doAutopartition( PartitionCoreModule* core, Device* dev, Choices::AutoPartitionO
|
|||||||
const quint64 sectorSize = quint64( dev->logicalSize() );
|
const quint64 sectorSize = quint64( dev->logicalSize() );
|
||||||
if ( mayCreateSwap )
|
if ( mayCreateSwap )
|
||||||
{
|
{
|
||||||
quint64 availableSpaceB = quint64( dev->totalLogical() - firstFreeSector ) * sectorSize;
|
quint64 availableSpaceB = quint64( lastUsableSector - firstFreeSector + 1 ) * sectorSize;
|
||||||
suggestedSwapSizeB = swapSuggestion( availableSpaceB, o.swap );
|
suggestedSwapSizeB = swapSuggestion( availableSpaceB, o.swap );
|
||||||
// Space required by this installation is what the distro claims is needed
|
// Space required by this installation is what the distro claims is needed
|
||||||
// (via global configuration) plus the swap size plus a fudge factor of
|
// (via global configuration) plus the swap size plus a fudge factor of
|
||||||
@ -165,6 +165,7 @@ doAutopartition( PartitionCoreModule* core, Device* dev, Choices::AutoPartitionO
|
|||||||
shouldCreateSwap = availableSpaceB > requiredSpaceB;
|
shouldCreateSwap = availableSpaceB > requiredSpaceB;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
qint64 lastSectorForRoot = lastUsableSector;
|
||||||
if ( shouldCreateSwap )
|
if ( shouldCreateSwap )
|
||||||
{
|
{
|
||||||
lastSectorForRoot -= suggestedSwapSizeB / sectorSize + 1;
|
lastSectorForRoot -= suggestedSwapSizeB / sectorSize + 1;
|
||||||
@ -183,7 +184,7 @@ doAutopartition( PartitionCoreModule* core, Device* dev, Choices::AutoPartitionO
|
|||||||
FileSystem::LinuxSwap,
|
FileSystem::LinuxSwap,
|
||||||
QStringLiteral( "swap" ),
|
QStringLiteral( "swap" ),
|
||||||
lastSectorForRoot + 1,
|
lastSectorForRoot + 1,
|
||||||
dev->totalLogical() - 1,
|
lastUsableSector,
|
||||||
KPM_PARTITION_FLAG( None ) );
|
KPM_PARTITION_FLAG( None ) );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -194,7 +195,7 @@ doAutopartition( PartitionCoreModule* core, Device* dev, Choices::AutoPartitionO
|
|||||||
FileSystem::LinuxSwap,
|
FileSystem::LinuxSwap,
|
||||||
QStringLiteral( "swap" ),
|
QStringLiteral( "swap" ),
|
||||||
lastSectorForRoot + 1,
|
lastSectorForRoot + 1,
|
||||||
dev->totalLogical() - 1,
|
lastUsableSector,
|
||||||
o.luksFsType,
|
o.luksFsType,
|
||||||
o.luksPassphrase,
|
o.luksPassphrase,
|
||||||
KPM_PARTITION_FLAG( None ) );
|
KPM_PARTITION_FLAG( None ) );
|
||||||
|
Loading…
Reference in New Issue
Block a user