Extend/resize lvm

Physical volume (pv)

Volume group (vg)

Logical volume (lv)

To extend lvm admins need to know if they needs to extend vg or lv. So if admins want to increase the space in lv then vg should have space then admins can increase, if vg doesn't have enough space then admins needs to add space in vg by create pv & then add space in vg.

In following steps first add additional disk or you can use partitions if you using partitions in lvm.

Step 1: Create pv on your new additional disk or paritition

Command to create  physical volume " pvcreate /dev/sdc"


Step2: Extend vg

Command to extend vg is "vgextend datavg /dev/sdc"


Step3: extend lv

Command to extend lv is "lvextend datalv -l +3G datavg -r"

-r resize the datalv

-l option is to alternative way to resize the logical volume


Step4: Create file system with xfs/ext

mkfs.ext4 /dev/datavg/datalv


Step5: Mount persistantly in /etc/fstab

/dev/datavg/datalv /tmp/apps ext4  defaults 0 0

Comments

Post a Comment