0

I just bought a new hard drive, and I would like to use LVM on it. I created therefore a new physical volume with pvcreate, accepting the default settings (which is probably the wisest thing to do).

As result, I've got my phiscal size all together, and no physical extent size, as shown by pvdisplay:

PV Size               931.51 GiB
Allocatable           yes
PE Size               0

After that I used vgcreate to create my volume group. Again with default settings. What I obtained was not exactly what I expected, because of that 33.71 MiB wasted:

PV Size               931.51 GiB / not usable 33.71 MiB
Allocatable           yes 
PE Size               4.00 MiB

By using the --units B option ov pvdisplay I was able to obtain the actual physical volume size, that is size = 1000204885504 bytes. Some fast calculations tell me that if we divide it by blocks of 4 MiB we obtain...

size / (4 * mib)
238467.42761

With a wasted area of 1.71044 MiB

size - (4 * mib * 238467)
1793536

Which is much more reasonable.

I tried to create different sized volume groups by changing the -s flag. Eventually I tried with 4 KiB, obtained a 100% utilization of my physical volume:

PV Size               931.51 GiB / not usable 0    
Allocatable           yes 
PE Size               4.00 KiB

So, my questions are:

  • Why did I get 33.71 MiB flagged as not usable when the reasonable amount would have been 1.71?

  • Is it advisable to maintain a very small physical extent size in order to minimize the wasted space? I read on the Internet that a large physical extent reduces the effects of external fragmentation. What is in your opinion a good compromise?

Thanks in advance for any kind answer.

0

In general, even with LVM there is overhead from the formatting, while smaller pe (Physical extents) can lead to less "waste" it is semi misleading.

The smallest "waste" you can get on a tabled disk is 1.7M (backup header and formatting overhead)

smaller extents are better for LONG TERM stale storage not for running your OS,

smaller would be good for your "backups" drive for example and to be completely honest Filling the entirety of the disk when using LVM limits you some if dynamic reallocating of space is needed / desired as the LVM will have nearly no / no space for the "transitional part" of the resize..

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.