Extending Primary KVM Partitiion

Ben McGuire

Member
Sep 14, 2016
30
1
6
We have a qcow2 image but the image is only 4GB in size but when we try and resize the disk and new unallocated partitiion is created and we have no way to extend the primary partition.

How do we extend the primary partition from 4GB?

We do not want another partitiion as we cannot even do updates on this image as there is no more space left.
 
Why can´t you extend your partition? Easiest way is booting a live OS (like Ubuntu) and use gparted to extend your partitions.

Which OS do you run inside?
 
From what I am reading now it appears that the 'primary' partition cannot be extended while the partition is mounted. We have tried Gparted in Debian but the resized space we have added via Proxmox GUI only appears as unallocated space and the primary partition cannot be extended by the 10Gb we added. We can use this space as another partition but we need the primary partition extended as we cannot even run an update as the partition is 98% full.

In addition using this same qcow2 image we have created a template and when provisioning a new VM the disk space is still 4GB and the added storage just appears as before as unallocated space so the process of cloning and templates are useless when creating clones/templates and expecting a bigger disk. Maybe I have missed something but our next step is to download the qcow2 image and somehow resize it when it is unmounted.

If you have an alternative or simpler method I am all ears but I am a little disappointed that this image cannot be resized by the usual methods when creating VM via a template. FYI the qcow2 image is a customized image and how we imported it was I create a working VM and we just replaced the file in the applicable directory. I am not sure if us doing that somehow affects the resizing in Proxmox GUI but I though we had better add it just in case that is the reason.
 
From what I am reading now it appears that the 'primary' partition cannot be extended while the partition is mounted. We have tried Gparted in Debian but the resized space we have added via Proxmox GUI only appears as unallocated space and the primary partition cannot be extended by the 10Gb we added. We can use this space as another partition but we need the primary partition extended as we cannot even run an update as the partition is 98% full.

If you boot your VM with a live CD, your partitions are NOT mounted. Just ask google or youtube for a howto (e.g. search for "resize partition linux live gparted")

There are always two steps:
  1. extend the virtual hard disk on the Proxmox VE GUI
  2. use a live CD to extend the partitions
 
Yes thank you Tom,

I am just downloading Gparted to resize. Hopefully it works.

I appreciate your input and I will post back with the results shortly
 
Well it seems there is something wrong as the partition cannot be increased. I had to delete the swap partition as it was in between the primary partition and the unallocated space. Now the main 10GB partition cannot be increased.. See screen shot.

Any ideas?
 

Attachments

  • gparted.png
    gparted.png
    39.8 KB · Views: 11
Before deleting the SWAP you could have done the following:
* move the END of the EXTENDED partition to the end-of-disk (right)
* move the SWAP partition to the right.
* move the BEGINNING of the EXTENDED partition to the right.
* increase the size of the first partition.

Assuming you have already done what you have shown in the screenshot ...
* move the END of the EXTENDED partition to the end-of-disk (right)
* move the BEGINNING of the SWAP to the right so that size of the EXTENDED partition is 16 GiB (nothing allocated so far)
* create a SWAP partition INSIDE the extended partition.
* extend the size of the first partition to the max possible.

HTH,
Regards,
Shantanu
 
  • Like
Reactions: Ben McGuire
Gentleman,

Thank you!!
It appears that I needed to delete the extended partition and once i did this i was then able to extend the primary partition and then recreated the swap....I am now logged into the vm and seeing the added storage to the primary partition.

Thank you !!!
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!