fdisk -l #Check disk size
Disk /dev/sda: 185.9 GB, 199715979264 bytes, 390070272 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x000ccef8
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 1050623 524288 83 Linux
/dev/sda2 1050624 167772159 83360768 8e Linux LVM
We now have 100gb unassaigned after our disk was increased
fdisk /dev/sda
If fdisk -l now shows the correct layout, you can continue, else reboot.
pvs # You will see it has not changed yet, still 79GB PV VG Fmt Attr PSize PFree /dev/sda2 centos lvm2 a-- <79.47g 0 pvresize /dev/sda2 #Request PV to resize to suit new sda partition pvs # The PV is now 179GB PV VG Fmt Attr PSize PFree /dev/sda2 centos lvm2 a-- <178.37g 99.72g
vgdisplay |grep Free Free PE / Size 3124/ 99.72 GiB
We have 3124 extends now to use
lvextend -l +1000 /dev/centos/root #add 1000 of them too a logical volume called root #The remaining 2124 (64gb) are saved for later
lvextend -L +50GB /dev/centos/root #add 50GB of to a logical volume called root #You may have to fiddle with the numbers to get the right space added
lvextend -l +100%FREE /dev/centos/root #assign ALL space to the root
resize2fs /dev/centos/root #this can be done without unmounting
lvdisplay |grep Size Alloc PE / Size 4093 / <131.72 GiB df -h /dev/mapper /centos-root xfs 131G 20G 109G 15% /
All good!