Extend Root partition LVM space on running system
Type lsblk and see where your partition attached on same disk or not. If you have at least 1 partition not used on same disk go following to number 1 step. And if you adding physichal disk, run this : a. fdisk /dev/sdb b. n (new partition) c. p (primary) (Press ENTER) (Use default partition number) (Press ENTER) (Use default first sector) (Press ENTER) (Use default last sector) d. t (change the partition type) e. 8e (Linux LVM) f. w (write) Continue to number 1 step.
- Create new partition (ex: /dev/sda3) from unallocated space. I am use “cfdisk” and type LVM / 8E
- Check partition applied or not > “cat /proc/partitions”, if /dev/sda3 not shown, apply first > “partprobe /dev/sda” then check it again
- Create psychal volume > “pvcreate /dev/sda3”
- Extend volume group > “vgextend centos /dev/sda3”
- Extend root partition > “lvextend -l +100%FREE /dev/mapper/centos-root”
- Apply via resize2fs > “resize2fs /dev/mapper/centos-root”
- Apply via xfs > “xfs_growfs /dev/mapper/centos-root”