Managing LVM partitions on CentOS

add disk in vmware first so it shows up, and reboot the system for it to become available.

# fdisk it new disk is /dev/sdc in my case
/sbin/fdisk /dev/sdc
n [enter]
p [enter]
1 [enter]
t [enter]
8e [enter]
w [enter]

# create lvm physical volume so lvm knows this new sdc1 partition exists
Create LVM Physical Volume

pvcreate /dev/sdc1

# vgdisplay to get the volume group name in my case in my case VG Name is vg_puppet

Add disk to volume group

Extend the vg_puppet lv_root partition to take 100% of the free space in the volume group, in other words the disk we just added.

vgextend vg_puppet /dev/sdc1

Now extend the volume group to use the new space.

lvextend -l +100%FREE /dev/mapper/vg_puppet-lv_root

Resize the partition online.

resize2fs /dev/mapper/vg_puppet-lv_root

Create a New Volume Group and Logical Volume

We have /dev/sdb and /dev/sdc as 1TB new physical disks added to a system, and we want to combine them into a single large 2TB disk.
Partition the new disks in fdisk
Create a single large partition in fdisk and write it so we have /dev/sdb1 and /dev/sdc1
Create physical volumes
First create the physical volume, then we’ll create a Volume Group, and then a logical volume.

Create Volume Group

Create Logical Volume
A logical volume is what you actually format and mount. In this command we use 100% of the free space on the volume group (vg_name), assign it a name (lv_name).

Partition and format the new Logical Volume

# partition it as normal in fdisk
fdisk /dev/mapper/vg_name-lv_name
# now format it, we'll use ext4
mkfs.ext4 /dev/mapper/vg_name-lv-name

Mount the drive
Mount the new lv as you would any drive.

mount /dev/mapper/vg_name-lv-name /mnt/

Get UUID for /etc/fstab and add it

# this displays UUID along with fs type like ext4
blkid /dev/mapper/vg_name-lv-name
# add to fstab
echo "`blkid /dev/mapper/vg_name-lv_name | awk '{print $2}'` /mnt ext4 defaults 1 1" >> /etc/fstab