How to Extend LVM (Logical Volume Management) in CentOS/Rhel 7.x

How to Extend LVM (Logical Volume Management) in CentOS/Rhel 7.x

Prerequisites : https://www.natsav.com/blog/2017/01/09/configure-lvm-logical-volume-management-disc-management-on-centosrhel-7-x/

Now we extend Logical Volume as follow :

Adding a new Physical Volume we have to use fdisk to Create the LVM partition.

#fdisk /dev/sda 
Command (m for help) : n
Command action
 e extended
 p primary partion 
p
Partition number (1-4) : 2
First cylinder :
second cylinder : +2G
Command (m for help) : t
select partition : 2
Hex code (type L to List codes) : 8e
Command (m for help) : p
Command (m for help) : w
#partprobe /dev/sda

Create a new Physical Volume :

#pvcreate /dev/sda2

Now check Physical Volume :

#pvs

Now Extending the Volume Group :

#vgextend myvol /dev/sda2

Now check Volume Group :

#vgs

Now Extending the Logical Volume :

#lvextend -L +100%FREE /dev/myvol/lv1

Now,we need to resize the file-system using following command :

#resize2fs /dev/myvol/lv1

Now check Logical Volume :

#lvs

Leave a Reply

Your email address will not be published. Required fields are marked *