Chapter 3. Managing LVM volume groups


You can create and use volume groups (VGs) to manage and resize multiple physical volumes (PVs) combined into a single storage entity.

Extents are the smallest units of space that you can allocate in LVM. Physical extents (PE) and logical extents (LE) has the default size of 4 MiB that you can configure. All extents have the same size.

When you create a logical volume (LV) within a VG, LVM allocates physical extents on the PVs. The logical extents within the LV correspond one-to-one with physical extents in the VG. You do not need to specify the PEs to create LVs. LVM will locate the available PEs and piece them together to create a LV of the requested size.

Within a VG, you can create multiple LVs, each acting like a traditional partition but with the ability to span across physical volumes and resize dynamically. VGs can manage the allocation of disk space automatically.

3.1. Creating an LVM volume group

You can use the vgcreate command to create a volume group (VG). You can adjust the extent size for very large or very small volumes to optimize performance and storage efficiency. You can specify the extent size when creating a VG. To change the extent size you must re-create the volume group.

Prerequisites

  • Administrative access.
  • The lvm2 package is installed.
  • One or more physical volumes are created. For more information about creating physical volumes, see Creating an LVM physical volume.

Procedure

  1. List and identify the PV that you want to include in the VG:

    # pvs
    Copy to Clipboard
  2. Create a VG:

    # vgcreate VolumeGroupName PhysicalVolumeName1 PhysicalVolumeName2
    Copy to Clipboard

    Replace VolumeGroupName with the name of the volume group that you want to create. Replace PhysicalVolumeName with the name of the PV.

    To specify the extent size when creating a VG, use the -s ExtentSize option. Replace ExtentSize with the size of the extent. If you provide no size suffix, the command defaults to MB.

Verification

  • Verify that the VG is created:

    # vgs
    
      VG              #PV #LV #SN Attr   VSize  VFree
      VolumeGroupName   2   0   0 wz--n- 28.87g 28.87g
    Copy to Clipboard

3.2. Creating volume groups in the web console

Create volume groups from one or more physical drives or other storage devices.

Logical volumes are created from volume groups. Each volume group can include multiple logical volumes.

Prerequisites

  • You have installed the RHEL 10 web console.

    For instructions, see Installing and enabling the web console.

  • The cockpit-storaged package is installed on your system.
  • Physical drives or other types of storage devices from which you want to create volume groups.

Procedure

  1. Log in to the RHEL 10 web console.

    For details, see Logging in to the web console.

  2. Click Storage.
  3. In the Storage table, click the menu button.
  4. From the drop-down menu, select Create LVM2 volume group.

    Image displaying the available options in the Storage table drop-down menu. Selecting Create LVM2 volume group.
  5. In the Name field, enter a name for the volume group. The name must not include spaces.
  6. Select the drives you want to combine to create the volume group.

    cockpit create volume group

    The RHEL web console displays only unused block devices. If you do not see your device in the list, make sure that it is not being used by your system, or format it to be empty and unused. Used devices include, for example:

    • Devices formatted with a file system
    • Physical volumes in another volume group
    • Physical volumes being a member of another software RAID device
  7. Click Create.

    The volume group is created.

Verification

  • On the Storage page, check whether the new volume group is listed in the Storage table.

3.3. Renaming an LVM volume group

You can use the vgrename command to rename a volume group (VG).

Prerequisites

  • Administrative access.
  • The lvm2 package is installed.
  • One or more physical volumes are created. For more information about creating physical volumes, see Creating an LVM physical volume.
  • The volume group is created. For more information about creating volume groups, see Creating an LVM volume group.

Procedure

  1. List and identify the VG that you want to rename:

    # vgs
    Copy to Clipboard
  2. Rename the VG:

    # vgrename OldVolumeGroupName NewVolumeGroupName
    Copy to Clipboard

    Replace OldVolumeGroupName with the name of the VG. Replace NewVolumeGroupName with the new name for the VG.

Verification

  • Verify that the VG has a new name:

    # vgs
    
      VG                  #PV #LV #SN Attr   VSize  VFree
      NewVolumeGroupName   1   0   0 wz--n- 28.87g 28.87g
    Copy to Clipboard

3.4. Extending an LVM volume group

You can use the vgextend command to add physical volumes (PVs) to a volume group (VG).

Prerequisites

  • Administrative access.
  • The lvm2 package is installed.
  • One or more physical volumes are created. For more information about creating physical volumes, see Creating an LVM physical volume.
  • The volume group is created. For more information about creating volume groups, see Creating an LVM volume group.

Procedure

  1. List and identify the VG that you want to extend:

    # vgs
    Copy to Clipboard
  2. List and identify the PVs that you want to add to the VG:

    # pvs
    Copy to Clipboard
  3. Extend the VG:

    # vgextend VolumeGroupName PhysicalVolumeName
    Copy to Clipboard

    Replace VolumeGroupName with the name of the VG. Replace PhysicalVolumeName with the name of the PV.

Verification

  • Verify that the VG now includes the new PV:

    # pvs
    
      PV         VG              Fmt  Attr PSize  PFree
      /dev/sda   VolumeGroupName lvm2 a--  28.87g 28.87g
      /dev/sdd   VolumeGroupName lvm2 a--   1.88g  1.88g
    Copy to Clipboard

3.5. Combining LVM volume groups

You can combine two existing volume groups (VGs) with the vgmerge command. The source volume will be merged into the destination volume.

Prerequisites

  • Administrative access.
  • The lvm2 package is installed.
  • One or more physical volumes are created. For more information about creating physical volumes, see Creating an LVM physical volume.
  • Two or more volume groups are created. For more information about creating volume groups, see Creating an LVM volume group.

Procedure

  1. List and identify the VG that you want to merge:

    # vgs
    
      VG               #PV #LV #SN Attr   VSize  VFree
      VolumeGroupName1   1   0   0 wz--n- 28.87g 28.87g
      VolumeGroupName2   1   0   0 wz--n-  1.88g  1.88g
    Copy to Clipboard
  2. Merge the source VG into the destination VG:

    # vgmerge VolumeGroupName2 VolumeGroupName1
    Copy to Clipboard

    Replace VolumeGroupName2 with the name of the destination VG. Replace VolumeGroupName1 with the name of the source VG.

Verification

  • Verify that the VG now includes the new PV:

    # vgs
    
      VG               #PV #LV #SN Attr   VSize  VFree
      VolumeGroupName2   2   0   0 wz--n- 30.75g 30.75g
    Copy to Clipboard

3.6. Removing physical volumes from a volume group

To remove unused physical volumes (PVs) from a volume group (VG), use the vgreduce command. The vgreduce command shrinks a volume group’s capacity by removing one or more empty physical volumes. This frees those physical volumes to be used in different volume groups or to be removed from the system.

Procedure

  1. If the physical volume is still being used, migrate the data to another physical volume from the same volume group:

    # pvmove /dev/vdb3
      /dev/vdb3: Moved: 2.0%
     ...
      /dev/vdb3: Moved: 79.2%
     ...
      /dev/vdb3: Moved: 100.0%
    Copy to Clipboard
  2. If there are not enough free extents on the other physical volumes in the existing volume group:

    1. Create a new physical volume from /dev/vdb4:

      # pvcreate /dev/vdb4
        Physical volume "/dev/vdb4" successfully created
      Copy to Clipboard
    2. Add the newly created physical volume to the volume group:

      # vgextend VolumeGroupName /dev/vdb4
        Volume group "VolumeGroupName" successfully extended
      Copy to Clipboard
    3. Move the data from /dev/vdb3 to /dev/vdb4:

      # pvmove /dev/vdb3 /dev/vdb4
        /dev/vdb3: Moved: 33.33%
        /dev/vdb3: Moved: 100.00%
      Copy to Clipboard
  3. Remove the physical volume /dev/vdb3 from the volume group:

    # vgreduce VolumeGroupName /dev/vdb3
    Removed "/dev/vdb3" from volume group "VolumeGroupName"
    Copy to Clipboard

Verification

  • Verify that the /dev/vdb3 physical volume is removed from the VolumeGroupName volume group:

    # pvs
      PV           VG                Fmt    Attr   PSize      PFree       Used
      /dev/vdb1 VolumeGroupName  lvm2   a--    1020.00m    0          1020.00m
      /dev/vdb2 VolumeGroupName  lvm2   a--    1020.00m    0          1020.00m
      /dev/vdb3                  lvm2   a--    1020.00m   1008.00m    12.00m
      /dev/vdb4 VolumeGroupName  lvm2   a--    1020.00m    0          1020.00m
    Copy to Clipboard

3.7. Splitting an LVM volume group

If there is enough unused space on the physical volumes, a new volume group can be created without adding new disks.

In the initial setup, the volume group VolumeGroupName1 consists of /dev/vdb1, /dev/vdb2, and /dev/vdb3. After completing this procedure, the volume group VolumeGroupName1 will consist of /dev/vdb1 and /dev/vdb2, and the second volume group, VolumeGroupName2, will consist of /dev/vdb3.

Prerequisites

  • You have sufficient space in the volume group. Use the vgscan command to determine how much free space is currently available in the volume group.
  • Depending on the free capacity in the existing physical volume, move all the used physical extents to other physical volume using the pvmove command. For more information, see Removing physical volumes from a volume group.

Procedure

  1. Split the existing volume group VolumeGroupName1 to the new volume group VolumeGroupName2:

    # vgsplit VolumeGroupName1 VolumeGroupName2 /dev/vdb3
      Volume group "VolumeGroupName2" successfully split from "VolumeGroupName1"
    Copy to Clipboard
    Note

    If you have created a logical volume using the existing volume group, use the following command to deactivate the logical volume:

    # lvchange -a n /dev/VolumeGroupName1/LogicalVolumeName
    Copy to Clipboard
  2. View the attributes of the two volume groups:

    # vgs
      VG                  #PV #LV #SN Attr   VSize  VFree
      VolumeGroupName1     2   1   0 wz--n- 34.30G 10.80G
      VolumeGroupName2     1   0   0 wz--n- 17.15G 17.15G
    Copy to Clipboard

Verification

  • Verify that the newly created volume group VolumeGroupName2 consists of /dev/vdb3 physical volume:

    # pvs
      PV          VG                  Fmt     Attr    PSize       PFree       Used
      /dev/vdb1 VolumeGroupName1   lvm2    a--     1020.00m      0        1020.00m
      /dev/vdb2 VolumeGroupName1   lvm2    a--     1020.00m      0        1020.00m
      /dev/vdb3 VolumeGroupName2   lvm2    a--     1020.00m    1008.00m    12.00m
    Copy to Clipboard

3.8. Moving a volume group to another system

You can move an entire LVM volume group (VG) to another system by using the following commands:

vgexport
Use this command on an existing system to make an inactive VG inaccessible to the system. Once the VG is inaccessible, you can detach its physical volumes (PV).
vgimport
Use this command on the other system to make the VG, which was inactive in the old system, accessible in the new system.

Prerequisites

  • No users are accessing files on the active volumes in the volume group that you are moving.

Procedure

  1. Unmount the LogicalVolumeName logical volume:

    # umount /mnt/LogicalVolumeName
    Copy to Clipboard
  2. Deactivate all logical volumes in the volume group, which prevents any further activity on the volume group:

    # vgchange -an VolumeGroupName
      0 logical volume(s) in volume group "VolumeGroupName" now active
    Copy to Clipboard
  3. Export the volume group to prevent it from being accessed by the system from which you are removing it:

    # vgexport VolumeGroupName
      Volume group "VolumeGroupName" successfully exported
    Copy to Clipboard
  4. View the exported volume group:

    # pvscan
      PV /dev/sda1    is in exported VG VolumeGroupName [17.15 GB / 7.15 GB free]
      PV /dev/sdc1    is in exported VG VolumeGroupName [17.15 GB / 15.15 GB free]
      PV /dev/sdd1    is in exported VG VolumeGroupName [17.15 GB / 15.15 GB free]
      ...
    Copy to Clipboard
  5. Shut down your system and unplug the disks that make up the volume group and connect them to the new system.
  6. Plug the disks into the new system and import the volume group to make it accessible to the new system:

    # vgimport VolumeGroupName
    Copy to Clipboard
    Note

    You can use the --force argument of the vgimport command to import volume groups that are missing physical volumes and subsequently run the vgreduce --removemissing command.

  7. Activate the volume group:

    # vgchange -ay VolumeGroupName
    Copy to Clipboard
  8. Mount the file system to make it available for use:

    # mkdir -p /mnt/VolumeGroupName/users
    # mount /dev/VolumeGroupName/users /mnt/VolumeGroupName/users
    Copy to Clipboard

Additional resources

  • vgimport(8), vgexport(8), and vgchange(8) man pages on your system

3.9. Removing LVM volume groups

You can remove an existing volume group by using the vgremove command. Only volume groups that do not contain logical volumes can be removed.

Prerequisites

  • Administrative access.

Procedure

  1. Ensure the volume group does not contain logical volumes:

    # vgs -o vg_name,lv_count VolumeGroupName
    
      VG               #LV
      VolumeGroupName    0
    Copy to Clipboard

    Replace VolumeGroupName with the name of the volume group.

  2. Remove the volume group:

    # vgremove VolumeGroupName
    Copy to Clipboard

    Replace VolumeGroupName with the name of the volume group.

3.10. Removing LVM volume groups in a cluster environment

In a cluster environment, LVM uses the lockspace <qualifier> to coordinate access to volume groups shared among multiple machines. You must stop the lockspace before removing a volume group to make sure no other node is trying to access or modify it during the removal process.

Prerequisites

  • Administrative access.
  • The volume group contains no logical volumes.

Procedure

  1. Ensure the volume group does not contain logical volumes:

    # vgs -o vg_name,lv_count VolumeGroupName
    
      VG               #LV
      VolumeGroupName    0
    Copy to Clipboard

    Replace VolumeGroupName with the name of the volume group.

  2. Stop the lockspace on all nodes except the node where you are removing the volume group:

    # vgchange --lockstop VolumeGroupName
    Copy to Clipboard

    Replace VolumeGroupName with the name of the volume group and wait for the lock to stop.

  3. Remove the volume group:

    # vgremove VolumeGroupName
    Copy to Clipboard

    Replace VolumeGroupName with the name of the volume group.

Back to top
Red Hat logoGithubredditYoutubeTwitter

Learn

Try, buy, & sell

Communities

About Red Hat Documentation

We help Red Hat users innovate and achieve their goals with our products and services with content they can trust. Explore our recent updates.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

Theme

© 2025 Red Hat