Resize Disk VM on Proxmox

Nowadays, when all servers have moved from bare metal technology to VM or container, sometimes we face storage limitation problems on VM. And the solution is only to resize the size of the hard drive that was installed on our VM.

Resizing Disk on Proxmox VM / LVM is an action to add capacity of hard drive on the VM without losing data and without having to add a new disk partition in the LVM Volume Group.

Ok, we will directly go to the setting section, here the steps…

 

1. Adding Capacity on Proxmox UI

First of all, we go to the VM number on proxmox, highlight it, choose hardware, and choose the hard drive.

Choose Resize Disk, click it and fill the additional amount of hard disk capacity that you want to add.

After finishing to add the additional capacity, you can go to your VM, and check again the amount size of your partition

 

You see, still, there is no change in hard drive capacity.. so what do we have to do to solve this problem? We have added 80Gb of additional capacity, so the hard drive should be 120Gb by now, but still 40Gb. Okay, we need to run the next step, we have to resize the disk in VM so the OS (in this case, I used Ubuntu 20.04) can read all of the hard drive capacity.

 

2.  Tell Your OS to Resize The Hard Drive Capacity

the process that we have to do in proxmox UI has been done, so we have to tell our OS to resize the new hard drive capacity :

in console OS, you can type :

Command parted /dev/sda > then Command Print

as you can see, the partition still 80GB, though I have added the additional capacity to 120GB.

So we have to push the OS to recognize the amount size of the new partition

just type : resizepart 3 100% > print

the result will looks like the following image :

But wait.. dont be happy just yet…

If we run the df -h command, the OS still reading the old capacity..

so we have to check, the volume of the VM in proxmox and show current physical volume with command “pvdisplay”

Proxmox still reading the old capacity of hard drive :

so we have to resize the capacity of VM with command :

 pvresize /dev/sda3 > pvdisplay

 

Now the volume disk on proxmox has been changed to the new capacity, and the last step is to extend the logical volume,  so that we can get the size of the hard drive that matches the capacity we have added.

Just Type :

lvresize --extents +100%FREE --resizefs /dev/mapper/ubuntu--vg-ubuntu--lv

Yes… the time for happiness now , we can check with the command df -h ,

So you can see that the amount capacity has increased  according to the amount that we added earlier,

So we have finished and happy trying….

Leave a Reply

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