LVM: Two or more volume groups (VGs) on one physical volume (PV)

26,968

Solution 1

Yes, your understanding is correct.

A Volume Group (VG) comprises Physical Volumes (PV). If the PVs are in one VG, they can't then be placed in another Volume Group.

So if you want to create multiple volume groups, you need separate PVs for them. As you have noted, you can share a physical disk among VGs, but it would need to be partitioned, and PVs created from the partitions, and put into separate volume groups.

Solution 2

Two or more VGs can be created on a single drive, provided you partition it. However, you cannot create two VGs on the same disk partition or on a whole disk, as you noted.

Increasing number of PVs in a VG is usually done either by:

  • adding physical disk (it might require halting the OS).
  • creating LUN on a SAN. LUN stands for Logical Unit Number, and are reserved space on SAN seen as disk by the OS.

Unused partitions of a disk can be used to add more PVs; this can happen of you have not allocated all space to VG/PV, or in case of a LUN if you grow it. Note that, for Red Hat at least, if PV is a whole disk, the pvresize command can be used to change size of PV.

Share:
26,968

Related videos on Youtube

Mkay
Author by

Mkay

Updated on September 18, 2022

Comments

  • Mkay
    Mkay over 1 year

    I have just a short question about LVM.

    A physical volume is a Partition or a whole Disk. A volume group is a container for a least one physical volume.

    So I know that a volume group can have more than one physical volume for example 3 partitions on two disks in one volume group.

    But "for a least one physical" means that you can't create two or more volume groups on the same physical volume? So a volume group always uses the whole physical volume, is this correct?

    So if I like to have more volume groups on a disk I need to create more partitions on the disk (physical volume) first?

    Thanks

  • Celelibi
    Celelibi over 7 years
    Can't you stack the LVM layers? Creating two intermediate LV from one PV, and use those as PV for two distinct VG.
  • Archemar
    Archemar over 7 years
    I don't see the point, but maybe you can.
  • Celelibi
    Celelibi over 7 years
    Well, that way you can have one disk that's part of several VG, and the portion of the disk used for each VG could be easily changed. So you'd rely on the LV instead of native partitions to split a single disk for several VG.