Proxmox VE – Resize your virtual Hard disks – Part I

Hello World,

Lately, as you might have noticed, I’m focusing on KVM Virtual machines running Windows operating systems (the recent versions).  This post will again focus on KVM virtual machines. We will talk about resizing virtual disks.

It might happen that your virtual machine is running out of space or that you have provisioned too much disk space and you want to change this.  This operation can be performed within a Proxmox VE (PVE) infrastructure but only from the command line (the Web interface does not provide this option yet – maybe in version 2.0)

The resizing process is basically a 2-step process.  First, you will need to perform operations against the Virtual disk file (through a command line). Then, you will need to perform action within the operating system to commit the disk size’s changes.

Resizing the Virtual Disk file- How To

Let have a look to the first part of the process.

Step 1 – Backup your Virtual Machine

Before performing this operation, you should first backup your virtual machine in case something goes bad – shouldn’t but you never know :-)

Step 2 – Power off your Virtual Machine

 You should power off your virtual machine before applying changes. This ensures that the modifications are committed correctly by the PVE infrastructure.

Step 3 – Resizing the virtual disk

As mentioned earlier, to perform this change, you need to go through the command line (no GUI available yet).  You will need to connect to the PVE Console locally or remotely via putty for example.  From the console, if you type the following command

qemu-img –help

Click to enlarge

You will see a list of supported options.  If you have a recent Proxmox VE installation, you will see an option called resize. As the name implies, using this option will allow you to increase or shrink the size of the virtual disk in qcow2,raw or vmdk format. (that’s cool all supported format used by PVE).  The command can be used as follow

qemu-img resize <%location of the file%>  +| – <%size%>

Note : Wait before using this command – read this till end !!

Step 4 – Checking news the virtual disk size

You can use the ls –lh command to check that the file has been modified accordingly.


Click to enlarge

Or you can use the qemu-img info <%name of the virtual disk file%> to check that the file has been resized as required.

Click to enlarge


All in all the process is really not too difficult and you should be able to resizing disks image file as needed.  Before closing this post, I thought that having practical examples might be useful.

Practical Examples

Example 1 – Increasing disk size

In this scenario, we have a virtual machine with the VMID 111 that has a c: drive partition set to 20 GB. We need to increase the size of the partition to 25 GB.

 Click to enlarge

We shutdown the virtual machine and as described earlier, I’ll make a console connection (through putty) to the PVE host. I go to the folder holding all my virtual disks files (by default, all the virtual disks are located in /var/lib/vz/images) and then cd to the folder holding the virtual disk I want to resize. (In my case the vmid is 111 – view screenshot)


  Click to enlarge

I need to increase the size of the disk up to 25 GB. I basically need to add 5 GB to the initial file.  I’ll then type the following command

 qemu-img resize vm-111-disk-1.raw +5GB


  Click to enlarge

I can now reboot the virtual machine and you will see that the disk size has been set to 25 GB within the Operating system

  Click to enlarge

Example 2 – Shrinking disk size

In this scenario, we have a virtual machine with the VMID 111 that has a c: drive partition set to 25 GB. We need to increase the size of the partition to 20 GB.

  Click to enlarge

Again, I’ll shutdown the virtual machine, make a putty connection to the PVE host and go to the directory holding the virtual disk file I need to resize.  To shrink a disk, you need to type the following command

qemu-img resize <%name of the virtual disk%>  – –  -5GB


  Click to enlarge

If you boot your virtual machine, you will see that the disk has been reduced accordingly.


Note :

There is a difference in the notation between increasing and shrinking disk.  If you type this command,

qemu-img resize <%name of the virtual disk%>  -5GB

the new virtual disk will be only 5 GB in size. Pay attention when using the command to reduce the size.  This is not what you want. Instead you need to type

qemu-img resize <%name of the virtual disk%>  – –  – 5GB

to shrink the size of the disk by 5 GB.


I have found the correct shrinking command here


Final Notes

So far, we have just changed the size of the virtual disk.  Proxmox VE knows now that disk size has been updated.  However, we might still need to perform additional actions within the Operating system to apply these changes.  This will be explained in the next part of this post


Till then

See ya





13 Responses to “Proxmox VE – Resize your virtual Hard disks – Part I”

  1. maurizio says:

    sry, have you tested it. as i guessed it does not work as the booloader has not been updated with the new size. please delete this desaster of a howto

  2. admin says:

    Hello There,

    Yes It has been tested and validated multiple times…

    I might have helped you if you could have provided a more detailed description of your problem and the steps you’ve performed….Again, this procedue has been tested so this should be working

    Till next time

  3. Yuriy says:

    Thank you! It’s work perfectly. How enlage disk in windows?

  4. admin says:

    Hello there,

    you can read the part II of the post. This will explains how to resize disks within Operating system. You’ve missed the link to part II…. so have a look at

  5. Dave says:


    It appears when browsing to /var/lib/vz/images, these are virtual drives on the hosts’ local storage, correct? If so, how would one go about resizing a drive in an LVM group on an iSCSI SAN?

    Also, I’m running Proxmox 2, so I’m guessing there may be more to the web GUI now?

    Thank you!

    – – Dave

  6. Griffon says:

    Hello Dave,

    If you can wait a little bit…I’ll have to check first… This might become a new post….

    See ya

  7. Dave says:


    Sounds good, thank you.

    If it helps your next post, I was able to find that the drives on an iSCSI SAN are referenced under /dev/dm-0, dm-1, etc. You can run ‘dmsetup ls’ to see exactly which drives are behind the ‘dm-x’ symbolic links.

    What I did was:
    – Shut down the desired VM
    – Add/create a second hard drive to it, the full desired size
    – SSH into the Proxmox server and run a dd command, if=vm-101-disk-1 of=vm-101-disk2
    – When that copy/duplication job is done, remove the smaller drive from the VM
    – Start the VM and tell Windows to expand the volume to occupy the new additional free space

    Let me know if you find a more elegant/streamlined way. :)

    Thanks again.

    – – Dave

  8. Griffon says:

    Hello Dave,

    To answer your question (short version), yes there is an easier way to increase the size of the virtual machine….

    – first, get info about LVM – typing lvdisplay
    – locate the vg name that needs to be modified
    – type lvresize -L+SizeGB < %vg name%>
    – type lvchange –refresh < %vg name%>
    – within the os, need to resize the disk or create additional partition….

    A post is on its way…..

    Hope this answer your question

    See ya

  9. Vlad says:

    FYI – I tried to shrink the Windows 7-64 virtual disk (virtio driver) by 10Gb. The VM did not boot up with new image file. I’ve got a restore interface with no dirve found.

  10. Griffon says:

    Hello Vlad,

    Sorry to hear that, have you followed all the steps – more specifically Step 1 where I mention about the backup of your VM in case something goes wrong….

    anyway, can you check one of the following

    Have you typed the correct command
    This is the correct command to shrink size of a disk qemu-img resize vm-101-disk-1.raw – – -1OG If you have typed qemu-img resize vm-101-disk-1.raw -10G, then the new size of the disk would be 10 GB. this is not a correct command. You might have deleted some files now

    -> in your Proxmox Console, what’s the size of the disk ?

    can you boot up your virtual machine and start in Recovery Mode and see if the wizard can restore/repair your Windows Installation ?
    Possibly, still using recovery Mode (Press F8 during the boot Process), can you open a command prompt and see if you can list disk and partitions using Diskpart.

    If recovery mode is not detecting disk, you will need to load the virtio drivers. Try to repair from this mode. If this fail, open a command prompt and check that you can see the disk and partitions using diskpart utility. check that the partition size and filesystem is showing up correctly.

    Let me know what you can see and I’ll try to help out

    I’ll check again the procedure but I’ve used many times with Windows 7/windows 2008 R2 64-bit and had really minimum issues with that

    Hope this help
    See ya

  11. Vlad says:


    Yes, I have a backup and already restored the VM.
    I followed your instructions closely and am sure that the command line was correct. The resultant size of .raw file was what I expected.
    The Window restore/repair wizard was started automatically upon boot with the new image.
    The C: drive was not found and I was prompted to insert disk with drivers as if virtio scsi driver was lost.
    I did not experiment with further recovery options.
    Do you think if the disk defragmentation might be needed prior to shrinking?

    I am going to try drive shrinking again on the same file and will report results.

  12. Vlad says:

    Follow up.

    It looks like with drive shrinking two basic steps should be taken in reverse order. First, you shrink drive in Windows client. The shrink wizard queries disk for available shrink space up to the point where any unmovable files are found. (In my case the maximum shrink size was 7GB, not 10GB.)
    Second, you shrink the drive on host using maximum shrinkage size determined by the client.
    So, instead of my voluntaristic 10GB I shrank the volume by 7GB and everything went perfectly!

    Thanks for very useful tutorials.

  13. Griffon says:

    Hello Vlad,

    This is great news….(I’m Happy you have your virtual machine back online). You might be right in your statement.
    It might be indeed good to warn the user that you have a max shrinking size.
    I’ll probably update this post to be more specific about the shrinking part..thank to you

    Good job Man !! :-))

    See ya around
    Till Next Time

Leave a Reply