Announcement

How To Add Physical Volume (PV) to a Volume Group (VG) in LVM


More often we want to add new physical volumes to an existing volume group when logical volumes need to be increased. The physical volume can either be a partition or an whole disk. This guide will take you through the steps to add an entire disk for addition into an existing volume group under CentOS or Red Hat Linux.


The following steps can be applied on CentOS and Red Hat Linux Enterprise.

Adding Physical Volume (VG) to Volume Group (VG)

You must be root to perform the following steps. First, we need to set the partition type to Linux LVM, 0x8e, using fdisk command.

fdisk /dev/sdc

Type t to select the partition:
 
Command (m for help): t
Partition number (1-4): 1

Set partition type as 8e which for Linux LVM.
 
Hex code (type L to list codes): 8e

##output of the partition type 8e is

 Device Boot      Start         End      Blocks    Id   System
/dev/sdc1          1675        2054     3052087   8e  Linux

Now save and exit fdisk with the write/quit command by typing w. The changes you have made will be permanent after this command is executed.

Command (m for help): w

Lastly, reload the partition table after changing it by either rebooting the machine or executing partprobe command.
 
partprobe

The partition/disk needs to be added as a physical volume using pvcreate.
 
pvcreate /dev/sdc1

The physical volume needs to be added to the volume group using vgextend.
 
vgextend vg_data /dev/sdc1