Extend LVM partition after resizing disk – Linux

First, rescan the disk after upgrading its size. Swap out sda for your disk:

echo 1>/sys/class/block/sda/device/rescan

Then open parted:

parted

Inside parted send:

print

It will display the partitions on the disk:

Number Start End Size File system Name Flags
1 1049kB 2097kB 1049kB bios_grub
2 2097kB 1076MB 1074MB ext4
3 1076MB 644GB 643GB

Send resizepart, then insert the partition number you wish to extend. After that insert the new partition size in MB:

(parted) resizepart 
Partition number? 3
End?  [400.0GB]? 644245

Check the new size using:
fdisk -l

Extend the pv:
pvresize /dev/sda3

List your volume groups, the size should be adjusted automatically.

vgs

End the process with the resizing of the logical volume.

lvextend -l +100%Free /dev/vg01/lvvar OR lvextend -L+10G /dev/vg01/lvvar

Check the logical volume size:
lvs

Resize the file system:
resize2fs /dev/vg01/lvvar (for extX)

xfs_growfs /dev/vg01/lvvar (for xfs)

Check the result.

df -Th