Resize/Expand Proxmox disk Centos DirectAdmin

You've found you're running out of disk space in DirectAdmin (Proxmox VM), and you'd like to allocate more disk space. One would hope that it would be as simple as resizing the disk in Proxmox. This however, is only part of what is necessary to make the extra disk space available in DirectAdmin/Centos. Follow these steps:

  1. Resize the disk in Proxmox
  2. Login to the DirectAdmin/Centos VM and issue the following commands:
fdisk /dev/sda
n
p
ENTER
ENTER
w

An explanation of the above: First enter fdisk, and create create a new partition with n, press p for primary partition, then press ENTER and ENTER again to select the start and end for the partition. Finally press w to write the changes for the new partition. You might need to reboot after this for Centos to pickup the new partition. Run lsblk to check if it is visible without a reboot.

3. Add the new partition as a physical volume (PV)

pvcreate /dev/sda3

4. Next, extend the existing volume group

vgextend centos /dev/sda3

5. Find out which logical volume you'd like to add the newly added space to

lvdisplay

6. Assuming the LV path to which you'd like to add the space to is /dev/mapper/centos-home, run the following command to allocate all available space to the volume:

lvextend -l +100%FREE /dev/mapper/centos-home

7. Finally, change the filesystem to fit the new size:

xfs_growfs /dev/mapper/centos-home