CentOS / RHEL : How to find free space in a Volume Group in LVM

Knowing the free space remaining in a volume group is an important piece of information, especially when you want to :
1. add a new volume in the VG
2. add a new PV in the VG
3. extend an existing volume in the VG

Method 1 – using vgs command

vgs command simply puts the total size of the VG and free space directly.

# vgdisplay -v vg_os2 | grep Free
    Using volume group(s) on command line.
  Free  PE / Size       40672 / 158.88 GiB
  Total PE / Free PE    143072 / 40672

In most of the cases this command will be sufficient for you. In case you want details on PV level you can go for the method 2.

Method 2 – using vgdisplay command

Execute the command vgdisplay to get information of all volume groups on the system.

# vgdisplay

Example output is given below. The line “Free PE / Size” indicates the free physical extents in the VG and free space available in the VG respectively.

# vgdisplay
......
  --- Volume group ---
  VG Name               vg_os2
  System ID
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  9
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                5
  Open LV               5
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               558.88 GiB
  PE Size               4.00 MiB
  Total PE              143072
  Alloc PE / Size       102400 / 400.00 GiB
  Free  PE / Size       40672 / 158.88 GiB
  VG UUID               BXrCkO-bip9-fqjB-h4yd-JdNL-fUEq-Vsh6cq

From the example above there are 40672 available PEs or 158.88 GiB of free space.

Finding free space in in all PVs in a VG

To determine the number of free PEs on each physical device that is part of a volume group, execute the following command:

# vgdisplay -v [vg_name]

This will show volume groups and the physical volumes that are associated with each volume group.

Finding free space in all VGs

To easily find the free space in all VGS, execute the below command.

# vgdisplay | grep Free

For example :

# vgdisplay | grep Free
    Using volume group(s) on command line.
  Free  PE / Size       127 / 508.00 MiB
  Free  PE / Size       480 / 1.88 GiB
  Free  PE / Size       40672 / 158.88 GiB

To find free space in a specific VG only, provice the VG name in the above command. For example:

# vgdisplay -v vg_os2 | grep Free
    Using volume group(s) on command line.
  Free  PE / Size       40672 / 158.88 GiB
  Total PE / Free PE    143072 / 40672
Related Post