lvmteam/lvm2

lvcreate is demanding 4 PE/ 16 MiB extra

Closed this issue · 1 comments

I am trying to build an raw image using Image builder where I specify the LV's , the PV is computed correctly with a 1 MiB padding for metadata, but lvcreate complaining 4 PE short, adding that in the PV I get no error, but cannot find any logical reason for the extra space demanded by lvcreate.

the PR I am working on for error details

Not sure where is the problem on lvm2 side here.
pvcreate by design currently aligns metadata area on 1MiB.
vgcreate by default uses 4MiB extent size - so the LV can by allocated in 4MiB steps/units.
All of these settings are fully configurable by options - and user can select values in range of 512B to 4GiB in range.

The only 'limiting' factor can be the 'maximal' volume size size the size is expressed as num_of_extents (32bit) * extent_size(32bit) -> final_size (64bit)

So 4MiB extent size limits users to maximal VG size of 16PiB.
4KiB extent size -> 16TiB.

Final note - drives often come with various internal alignment rules - i.e. 512KiB is typical SSD/NVMe allocation unit so it's good idea to keep things aligned here as well.

So i.e. if you know max VG size will be 1TiB - you can use 'vgcreate -s 4k /dev/xxxx' and you can likely use all the PV space. Though if you will 1MiB alignment on PV header you can probably stay at 1MiB extent size as well.