How to extend partition size in Centos7

I have a local OS repository that is used by my local machines to get the Centos updates from.

I realised it has stopped working and it turned out that the disk is full.

The machine is hosted on a VMWare ESXi 6.7 server. Below are the steps needed to go through to get the partition size extended.

Shut it down and extend hardware size to new desired value in VMware ESXi web interface

Login into the machine through ssh and follow the next steps.

sudo parted

print
print free 
resizepart 2 72.2GB
quit

now change the physical volume

sudo pvresize -vt /dev/sda2
if everything looks okay then drop the test mode (t) and run it again

sudo pvresize -v /dev/sda2 

now resize the LVM

sudo lvresize -vtl +100%FREE /dev/centos_osrepository/root

again drop the t if you are happy with what you see.
sudo lvresize -vl +100%FREE /dev/centos_osrepository/root
 

now resize the file system

sudo xfs_growfs /dev/centos_osrepository/root 

that’s it.

Leave a Comment

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.