qcow2 file to big

q16marvin

Renowned Member
Jul 16, 2013
50
0
71
Hi,

root@proxmox2:/var/lib/vz/images/100# qemu-img info vm-100-disk-2.qcow2
image: vm-100-disk-2.qcow2
file format: qcow2
virtual size: 150G (161061273600 bytes)
disk size: 247G
cluster_size: 65536
Format specific information:
compat: 1.1
lazy refcounts: false


you see the virtual size is aber 150G, but disk size is 247.. so realy to big and my bare metal disk is full ...

how can i shrink this?

Thx!

Erik
 
I saw that even if i create qcow format for new machine ltes say size of 50GB, it will create file 50GB.
When i will execute conversion that i described below, the image shrink from 50GB to somethking like 1 KB and then when i am installing linux on it, it grows.
Anyway this is the way to save space :)

you can shutdown VM
and do this:
qemu-img convert -c -O qcow2 vm-100-disk-2.qcow2 vm-100-disk-2.qcow2.new
See if size recuded.
mv vm-100-disk-2.qcow2 vm-100-disk-2.qcow2.old
mv vm-100-disk-2.qcow2.new vm-100-disk-2.qcow2
 
In general, it's best to also use dd to create a file filled with zeroes then deleting it before shutdown.
dd of=filetodelete if=/dev/zero bs=10M ; echo > filtodelete; rm filtodelete; halt

So to speak.
 

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!