Skip to content

Calculate LVM PV limits based on lvmok partitions for single disk

Pascal Hambourg requested to merge pham/partman-auto-lvm:fix-add_envelope into master

Reason:

partman-auto-lvm splits the original recipe in two:

  • a recipe with non-lvmok partitions
  • a recipe with lvmok partitions

If the non-lvmok recipe does not define a partition to be used as a physical volume (called "envelope"), one with minimum=100MB and priority=1000 is added to it. Then the non-lvm recipe is performed on the disk. But as the PV minimum size is much lower than the sum of lvmok partition minimum sizes, non-lvmok partitions may be bigger than expected and the PV may be smaller. As a consequence, when the lvmok recipe is performed in the PV, lvmok partitions may be smaller than expected.

The mismatch has remained unnoticed because non-lvmok partitions (bios_grub, EFI and /boot) in current built-in recipes have a fixed size. But new recipes defining EFI and /boot partitions with variable sizes are being discussed, and the mismatch will become visible. For instance, the /boot partition may be bigger than expected by at least 260MB in a 512MB-1GB range, which is quite significant. See also discussion in https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1076952

This patch is an attempt to make partition sizes closer to the partman-auto-recipe specification when performing partman-auto built-in recipes on a single disk. I did minimal testing with the amd64-efi atomic built-in recipe.

WARNING: partman-lvm-auto may be used to perform custom recipes defining explicit PVs and/or on multiple disks. Such use cases should not be affected but feedback would be welcome.

Merge request reports

Loading