Commit c631f3e4 authored by Nikos Skalkotos's avatar Nikos Skalkotos

In bundle_volume keep partition starting points

When shrinking partitions, make sure that the shrinked partitions
always starts from the sector the initial partition started. Changing
this may destroy the boot loader.
parent 10a5c2bf
......@@ -222,9 +222,13 @@ class BundleVolume(object):
# Align to 2048
part_end = ((part_end + 2047) // 2048) * 2048
# Make sure the partition starts where the old partition started.
constraint = parted.Constraint(device=image_disk.device)
constraint.startRange = parted.Geometry(device=image_disk.device,
start=last.start, length=1)
image_disk.setPartitionGeometry(
image_disk.getPartitionBySector(last.start),
parted.Constraint(device=image_disk.device),
image_disk.getPartitionBySector(last.start), constraint,
start=last.start, end=part_end)
image_disk.commitToDevice()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment