Shrinking qcow VM image (with no free space)


New Member
Jan 25, 2022
So my proxmox node included bunch of VM + OMV. All VM use the nvme ssd except OMV (NAS solution), which is using 2TB hd. I somehow accidentally backup my 1.5TB into my OMV this and accidentally filling it up. I have then stopped the backup and restart the whole node. The storage now still detected at 1.5TB/2TB, but the qcow image for the OMV showing 2TB/2TB, and induce i/o error for the VM and locking it out.

I read about trimming the disk, so I enabled the discard option on the OMV disk, reboot and tried fstrim -av but the image still showing 2TB/2TB.

I read about proxmox command like below in the wiki:

qemu-img convert -O qcow2 image.qcow2_backup image.qcow2

but seem like this need a space for the new image to take up, which I dont have since the whole storage is filled up.

Can anyone help to tell me what to do in this instance, aside from buying another 2TB (I can't afford that) to get space to run the qemu-img as above? Ill provide any log if required.
To shrink a qcow2 image without creating a new file, the first thing you will have to do is to shrink the partions on that image. Make sure that no partition is present at the end of the image that you want to chop off. This will have to be done from inside a VM with a tool like parted, gparted or fdisk...
Once that is done, the image can be shrunken down with the following command:
qemu-img resize --shrink image.qcow2 100G
This will cut away 100GB at the end of the image.
It is crucial that you only cut away a part of the image that does not contain a partition!
Last edited:


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!