LVM – Setup and configure Volume Groups in RHEL 6/Centos 6 – Part 2

Welcome to Part 2 of this series of 4 articles detailing how to setup and configure multiple filesystems running on LVM partitions. Each article will cover a specific topic, per the below:

Part 1 – Setup and configure Physical Volumes
Part 2 – Setup and configure Volume Groups
Part 3 – Setup and configure Logical Volumes
Part 4 – Setup and configure Filesystems

In Part 2 we will cover Volume Group Management and will create a volume group called data and add /dev/sdb1/dev/sdd1 to it by running the following command:

vgcreate data /dev/sdb1 /dev/sdc1 /dev/sdd1

The result of which is:

[root@lnx-svr-01 ~]# vgcreate data /dev/sdb1 /dev/sdc1 /dev/sdd1
  Volume group "data" successfully created
[root@lnx-svr-01 ~]#

To display information about our volume groups we run vgdisplay:

[root@lnx-svr-01 ~]# vgdisplay
  --- Volume group ---
  VG Name               data
  System ID
  Format                lvm2
  Metadata Areas        3
  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                3
  Act PV                3
  VG Size               19.98 GiB
  PE Size               4.00 MiB
  Total PE              5114
  Alloc PE / Size       0 / 0
  Free  PE / Size       5114 / 19.98 GiB
  VG UUID               6eGhBN-LhH2-loZy-Vv04-adpB-NTiY-FToZMP

  --- Volume group ---
  VG Name               VolGroup
  System ID
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  3
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                2
  Open LV               2
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               19.51 GiB
  PE Size               4.00 MiB
  Total PE              4994
  Alloc PE / Size       4994 / 19.51 GiB
  Free  PE / Size       0 / 0
  VG UUID               4Con9G-f33H-UBae-36Z0-dhOE-K2y4-0HFDty

[root@lnx-svr-01 ~]#

As you can see from the above, we have two volume groups; data and VolGroup. The VolGroup volume group was created during the install of the operating system, so was already present before we created the data volume group in the previous step.

You can run vgscan to scan the system and display volume groups also:

[root@lnx-svr-01 ~]# vgscan
  Reading all physical volumes.  This may take a while...
  Found volume group "data" using metadata type lvm2
  Found volume group "VolGroup" using metadata type lvm2
[root@lnx-svr-01 ~]#

Please note that to rename the data volume group simply run the vgrename command:

[root@lnx-svr-01 ~]# vgrename data store
  Volume group "data" successfully renamed to "store"
[root@lnx-svr-01 ~]#

The above command renames the data volume group to store.

Please also note that to delete the volume group run vgremove:

[root@lnx-svr-01 ~]# vgremove data
  Volume group "data" successfully removed
[root@lnx-svr-01 ~]#

There is no need to run these two commands (vgrename and vgremove), they are for your reference only.

This is then end of Part 2. Please go to Part 3, to setup and configure Logical Volumes.

References:
How to Create LVM Partition in RHEL 6 / CentoOS
Linux Basics – LVM (Logical Volume Manager) Tutorial
How to Install LVM on Linux and Disk Operations
A Beginner’s Guide To LVM
How To Create LVM Using vgcreate, lvcreate, and lvextend lvm2 Commands