How to shrink qcow2 disk when you can't copy it ?

aroger

Member
May 16, 2019
17
0
21
34
Hello

I have a qcow2 disk with a empty partition to remove (about 6.5Tb to remove) but I don't have enough place on my host to make a copy using qemu-img convert.

How could I achieve this ?

Thank you
 
hi,

you could attach it to a VM and use tools like fdisk or parted or any other partitioning tool.
 
Hey

I used gparted to reduce the partition size, there is now a new empty partition (who is not formated) but my proxmox host do not see any difference. The disk space is still full..
 
try
Code:
apt install libguestfs-tools
virt-sparsify --in-place disk.qcow2
 
  • Like
Reactions: aroger
try
Code:
apt install libguestfs-tools
virt-sparsify --in-place disk.qcow2

Well in fact it's worked but the size was growing back to the same as before.
When I try to run virt-sparsify again, it show finish with no error but space is not freed.

Code:
[   3.6] Trimming /dev/sda2
[   4.9] Clearing Linux swap on /dev/sda3
[   5.3] Trimming /dev/sda4
[  85.7] Sparsify in-place operation completed with no errors

Still looking for a solution.
 

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!