LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Creating Volume Groups using PEs? (https://www.linuxquestions.org/questions/linux-newbie-8/creating-volume-groups-using-pes-4175502699/)

suDoh! 04-23-2014 09:35 AM

Creating Volume Groups using PEs?
 
Hi LQ,

I wanted to create a VG of 15 PEs where PE size is 8MB. So theoretically I should create a 90MB partition, format it with Linux LVM type and the create a PV on it before creating the VG with 8M chunks.

And I did that but it came up with 13 PEs instead of the forethought 15. And same happened when I tried bit larger partitions of 100|110|120 (MB) with varying number of PEs until I hit 128M when it exactly had 15 PEs.

What I want to understand is if there's any other math that I need to follow to get the exact PEs? Please can someone shed some light here.

Cheers.

rknichols 04-23-2014 12:36 PM

You are mixing MB (10^6) and MiB (2^20) units. Your "8MB" PE is actually 8388608 bytes, and 15 of those is 125829120 bytes. Then you have to add the 192KiB (196608 bytes) for the LVM PV header, so the total space needed is 126025728 bytes.

Your partitioning tool (Which one?) is probably using power-of-10 sizes for the partitions and then rounding that to the next MiB, so by that calculation you would to ask for 126MB or 127MB as the partition size.

suDoh! 04-23-2014 12:54 PM

I am using fdisk which is the default in RHEL.. and I do agree that the size is being converted to MiB so question is do I always have to convert the chunks into MiB (i.e. chunk_size*1048576) to determine the exact size and then multiply with the chunks I need in the VG. I.e., 8*1048576*15=125829120

Please could you also clarify that part about 192 KiB (196608 B) LVM PV header.. what kind of header is this and why are we adding this up to the value above? Sorry about being naive here but would appreciate an answer on this.

Cheers.

rknichols 04-23-2014 07:37 PM

An LVM physical volume begins with a header that identifies it as an LVM volume and contains space for the metadata that describes each of the logical volumes it contains. By default, 192KiB is reserved for this header. The files in /etc/lvm/backup are a textual representation of that metadata. For each physical volume in a VG you will see "pe_start =" giving the LBA offset where the extents begin and "pe_count =" giving the total number of extents available in that PV. Typically pe_start will be 384, which is an offset of 192KiB.

You can find some additional information at https://access.redhat.com/site/docum...omponents.html and https://access.redhat.com/site/docum..._metadata.html.

suDoh! 04-24-2014 04:47 AM

Thanks for clarifying!

Cheers.


All times are GMT -5. The time now is 07:17 PM.