Hello. I have a qcow2 VM with freebsd installed. The freebsd is installed on ZFS inside VM.
In the past I shrinked qcow2 file in this situation by setting a quota on the ZFS inside VM and then doing qemu-img convert. Unfortunately this time it does not work. I have no more than 40GB data on this VM and I set quota at 150GB but the resulting qcow2 file after convert is ~500GB. Can someone help me solve this mystery?
This is the process that I used:
On VM:
zfs set quota=150G zroot
zfs set refquota=150G zroot
Then I edited qemu-server config file to reflect that change (after shutting down VM of course)
On proxmox host:
pct rescan
mv vm-100-disk-0.qcow2 vm-100-disk-0.qcow2.bkp
qemu-img convert -O qcow2 vm-100-disk-0.qcow2.bkp vm-100-disk-0.qcow2
once again, there is only 40GB of data on this VM and I set quota at 150GB, here is the resulting file after convert
qemu-img info vm-100-disk-0.qcow2
image: vm-100-disk-0.qcow2
file format: qcow2
virtual size: 1 TiB (1099511627776 bytes)
disk size: 494 GiB
cluster_size: 65536
Format specific information:
compat: 1.1
compression type: zlib
lazy refcounts: false
refcount bits: 16
corrupt: false
extended l2: false
Child node '/file':
filename: vm-100-disk-0.qcow2
protocol type: file
file length: 494 GiB (530053660672 bytes)
disk size: 494 GiB
What is virtual size 1TB? the vm-100-disk-0.qcow2 file in fact takes 494GB (so this is not like a thin provisioning issue)
ls -als vm-100-disk-0.qcow2
517634948 -rw-r--r-- 1 root root 530053660672 Oct 13 02:06 vm-100-disk-0.qcow2
I am running out of space on the promox host and desperately need to convert this VM into reasonable size
In the past I shrinked qcow2 file in this situation by setting a quota on the ZFS inside VM and then doing qemu-img convert. Unfortunately this time it does not work. I have no more than 40GB data on this VM and I set quota at 150GB but the resulting qcow2 file after convert is ~500GB. Can someone help me solve this mystery?
This is the process that I used:
On VM:
zfs set quota=150G zroot
zfs set refquota=150G zroot
Then I edited qemu-server config file to reflect that change (after shutting down VM of course)
On proxmox host:
pct rescan
mv vm-100-disk-0.qcow2 vm-100-disk-0.qcow2.bkp
qemu-img convert -O qcow2 vm-100-disk-0.qcow2.bkp vm-100-disk-0.qcow2
once again, there is only 40GB of data on this VM and I set quota at 150GB, here is the resulting file after convert
qemu-img info vm-100-disk-0.qcow2
image: vm-100-disk-0.qcow2
file format: qcow2
virtual size: 1 TiB (1099511627776 bytes)
disk size: 494 GiB
cluster_size: 65536
Format specific information:
compat: 1.1
compression type: zlib
lazy refcounts: false
refcount bits: 16
corrupt: false
extended l2: false
Child node '/file':
filename: vm-100-disk-0.qcow2
protocol type: file
file length: 494 GiB (530053660672 bytes)
disk size: 494 GiB
What is virtual size 1TB? the vm-100-disk-0.qcow2 file in fact takes 494GB (so this is not like a thin provisioning issue)
ls -als vm-100-disk-0.qcow2
517634948 -rw-r--r-- 1 root root 530053660672 Oct 13 02:06 vm-100-disk-0.qcow2
I am running out of space on the promox host and desperately need to convert this VM into reasonable size