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

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • VCS
  • Interview Questions
  • Database
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

LVM Configuration : Volume Group (VG) Operations/Utilities

by admin

The next step in implementing LVM after creating the physical volumes or PV, is to assign the physical volumes to an existing or new volume group. Below are the most commonly used VG related operation/utilities.

Creating a Volume Group

Use the vgcreate command to create a new volume group. Space in a volume group is divided into “extents.” The default physical extent size is 4 MB. The syntax is:

# vgcreate [options] volume_group_name physical_volume

For example, to create a volume group named vg01 by using the /dev/sdb and /dev/sdc physical volumes with a default physical extent size of 4 MB, enter:

# vgcreate -v vg01 /dev/sdb /dev/sdc
    Wiping internal VG cache
    Wiping cache of LVM-capable devices
    Wiping signatures on new PV /dev/sdb.
    Wiping signatures on new PV /dev/sdc.
    Adding physical volume '/dev/sdb' to volume group 'vg01'
    Adding physical volume '/dev/sdc' to volume group 'vg01'
    Archiving volume group "vg01" metadata (seqno 0).
    Creating volume group backup "/etc/lvm/backup/vg01" (seqno 1).
  Volume group "vg01" successfully created

Displaying Volume Groups

Use the vgdisplay command to display attributes of volume groups:

# vgdisplay vg01
  --- Volume group ---
  VG Name               vg01
  System ID             
  Format                lvm2
  Metadata Areas        2
  Metadata Sequence No  1
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                0
  Open LV               0
  Max PV                0
  Cur PV                2
  Act PV                2
  VG Size               39.99 GiB
  PE Size               4.00 MiB
  Total PE              10238
  Alloc PE / Size       0 / 0   
  Free  PE / Size       10238 / 39.99 GiB
  VG UUID               FWwr8K-3HbK-qv2b-kDGv-sGOq-bLa2-2Vyc05

In addition to vgdisplay, two other commands list information about volume groups. The vgs command reports information about volume groups in a more condensed form. The vgscan command scans all disks for volume groups and rebuilds caches. Example:

# vgs
  VG   #PV #LV #SN Attr   VSize  VFree 
  cl     1   2   0 wz--n- 19.00g     0 
  vg01   2   0   0 wz--n- 39.99g 39.99g
# vgscan
  Reading volume groups from cache.
  Found volume group "vg01" using metadata type lvm2
  Found volume group "cl" using metadata type lvm2

Removing Volume Groups

Use the vgremove command to remove a volume group, for example:

# vgremove vg01
  Volume group "vg01" successfully removed
# vgdisplay vg01
  Volume group "vg01" not found
  Cannot process volume group vg01

Additional VG Commands

The following commands are used to manipulate volume groups:

  • vgcfgbackup : Back up volume group configurations.
  • vgcfgrestore : Restore volume group configurations.
  • vgchange : Change volume group attributes.
  • vgck : Check the consistency of volume groups.
  • vgconvert : Change the volume group metadata format.
  • vgexport : Unregister volume groups from the system.
  • vgextend : Add physical volumes to a volume group.
  • vgimport : Register an exported volume group with the system.
  • vgmerge : Merge volume groups.
  • vgmknodes : Create special files for volume group devices in /dev.
  • vgreduce : Remove physical volumes from a volume group.
  • vgrename : Rename a volume group.
  • vgsplit : Move physical volumes into a new or existing volume group.
RedHat / CentOS : A beginners guide to LVM
LVM Configuration : Logical Volume (LV) Operations/Utilities
LVM Configuration : Physical Volume (PV) Operations/Utilities

Filed Under: Linux

Some more articles you might also be interested in …

  1. “gnmic set” Command Examples
  2. ar – Create, modify, and extract from archives (.a, .so, .o)
  3. journalctl Command Examples in Linux
  4. dpkg-scanpackages: command not found
  5. airpaste – Share messages and files on the same network using mDNS (Command Examples)
  6. “docker system” Command Examples
  7. CentOS / RHEL : How to setup session idle timeout (inactivity timeout) for ssh auto logout
  8. netselect Command Examples in Linux
  9. How to install git on ubuntu 16.04
  10. loadtest Command Examples

You May Also Like

Primary Sidebar

Recent Posts

  • Vanilla OS 2 Released: A New Era for Linux Enthusiasts
  • mk Command Examples
  • mixxx Command Examples
  • mix Command Examples

© 2025 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright