archinstall icon indicating copy to clipboard operation
archinstall copied to clipboard

Fix #2924: Align LV offset to PE boundary

Open Screamnox opened this issue 8 months ago • 0 comments

Fixes #2924

PR Description

When creating multiple Logical Volumes (LVs), the installer hangs indefinitely because subsequent volumes fail due to insufficient space. The code computed a raw byte offset between the desired LV size and the available VG space but didn’t account for LVM’s Physical Extent (PE) alignment, so lvcreate’s internal rounding consumed extra PE and exhausted the VG.

Solution: Pre‑align the offset calculation to the nearest PE (default 4 MiB) using math.ceil(), ensuring that the final LV size matches expectations and preserves space for other volumes. (Perhaps the PE size could be retrieved dynamically from vg_info.)

Testing Results

  • [x] I have tested the code!

Setup:

  • 40 GiB disk: 1 GiB /boot + 39 GiB encrypted LUKS PV
  • VG size: 41,854,959,616 B (~38.98 GiB)
  • Target: 20 GiB root LV + 19 GiB home LV (ext4)

Before Fix

Calculated offset: 18,874,368 B (~4.5 PE)
Root LV requested: 21,455,962,112 B (~5,115.5 PE)
Root LV actual:    21,458,059,264 B (=5,116 PE)  ← lvcreate rounded up
Remaining space:   Insufficient for home LV
Result:            Home LV creation failed, installer hangs

After Fix

PE-aligned offset: 20,971,520 B (exactly 5 PE)
Root LV requested: 21,453,864,960 B (~5,115 PE)  
Root LV actual:    21,453,864,960 B (=5,115 PE)   ← no rounding needed
Home LV requested: 20,398,997,504 B (~4,863.5 PE)
Home LV actual:    20,401,094,656 B (=4,864 PE)
Result:            Both volumes created successfully

Reference: lvcreate(8) man page

Screamnox avatar Jun 16 '25 20:06 Screamnox