• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

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

by admin

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

Filed Under: Linux

Some more articles you might also be interested in …

  1. CentOS / RHEL : How to find which user run a specific command?
  2. homectl Command Examples in Linux
  3. curl Command Examples in Linux
  4. autoreconf: command not found
  5. atool Command Examples in Linux
  6. UNIX/Linux : Access control lists (ACLs) basics
  7. How to enable/disable wayland on Ubuntu 22.04
  8. efibootmgr Command Examples in Linux
  9. CentOS / RHEL : How to rotate /var/log/wtmp and /var/log/btmp file using logrotate
  10. How to Use rpm2cpio Command in Linux

You May Also Like

Primary Sidebar

Recent Posts

  • powertop Command Examples in Linux
  • powertop: command not found
  • powerstat: command not found
  • powerstat Command Examples in Linux

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright