Related to 26bb907, both gpt and msdos partitions need the 1 sector gap now

This commit is contained in:
Anders Ingemann 2015-01-19 23:53:21 +01:00
parent a62ce1705a
commit 4cbc8e4f8e
2 changed files with 13 additions and 1 deletions

View file

@ -34,7 +34,7 @@ class GPTPartitionMap(AbstractPartitionMap):
# Offset all partitions by 1 sector.
# parted in jessie has changed and no longer allows
# gpt partitions to be right next to each other.
# partitions to be right next to each other.
partition_gap = Sectors(1, sector_size)
# The boot and swap partitions are optional

View file

@ -31,13 +31,25 @@ class MSDOSPartitionMap(AbstractPartitionMap):
last_partition())
self.partitions.append(self.boot)
# Offset all partitions by 1 sector.
# parted in jessie has changed and no longer allows
# partitions to be right next to each other.
partition_gap = Sectors(1, sector_size)
if 'swap' in data:
self.swap = MSDOSSwapPartition(Sectors(data['swap']['size'], sector_size), last_partition())
if self.swap.previous is not None:
# No need to pad if this is the first partition
self.swap.pad_start += partition_gap
self.swap.size -= partition_gap
self.partitions.append(self.swap)
self.root = MSDOSPartition(Sectors(data['root']['size'], sector_size),
data['root']['filesystem'], data['root'].get('format_command', None),
last_partition())
if self.root.previous is not None:
self.root.pad_start += partition_gap
self.root.size -= partition_gap
self.partitions.append(self.root)
# Mark boot as the boot partition, or root, if boot does not exist