The size of among of data inside VM doesn't mach the total of virtual disk.

Gilberto Ferreira

Renowned Member
Hello there

I have a VM here with Ubuntu Focal.
The root disk lay down in a LVM group which has the site about 1TB.
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vgcloud-root 982G 654G 279G 71% /

But when I get the information about disk size using qemu-img, surprisely I get other results.

qemu-img info /vmsgluster/images/109/vm-109-disk-1.qcow2
image: /vmsgluster/images/109/vm-109-disk-1.qcow2
file format: qcow2
virtual size: 0.977 TiB (1073741824000 bytes)
disk size: 299 GiB
cluster_size: 65536
Format specific information:
compat: 1.1
compression type: zlib
lazy refcounts: false
refcount bits: 16
corrupt: false
extended l2: false

So I am a bit confuse.
The disk size is related to the Avail data inside the VM?

And worst, when I checked the storage in Proxmox I get this:
Filesystem Size Used Avail Use% Mounted on
gluster2:VMSGLUSTER 5.9T 327G 5.6T 6% /vmsgluster

If I list the storage I get:
pvesm list VMS
Volid Format Type Size VMID
VMS:100/vm-100-disk-0.qcow2 qcow2 images 107374182400 100
VMS:101/vm-101-disk-0.qcow2 qcow2 images 42949672960 101
VMS:102/vm-102-disk-0.qcow2 qcow2 images 34359738368 102
VMS:102/vm-102-state-snap-13042023.raw raw images 4003732480 102
VMS:103/vm-103-disk-0.qcow2 qcow2 images 107374182400 103
VMS:103/vm-103-state-teste.raw raw images 1776717824 103
VMS:104/vm-104-disk-0.qcow2 qcow2 images 322122547200 104
VMS:105/vm-105-disk-0.qcow2 qcow2 images 21474836480 105
VMS:105/vm-105-disk-1.qcow2 qcow2 images 274877906944 105
VMS:106/vm-106-disk-0.qcow2 qcow2 images 21474836480 106
VMS:106/vm-106-disk-1.qcow2 qcow2 images 1073741824000 106
VMS:107/vm-107-disk-0.qcow2 qcow2 images 21474836480 107
VMS:107/vm-107-disk-1.qcow2 qcow2 images 64424509440 107
VMS:108/vm-108-disk-0.qcow2 qcow2 images 21474836480 108
VMS:109/vm-109-disk-1.qcow2 qcow2 images 1073741824000 109
VMS:9998/vm-9998-disk-0.qcow2 qcow2 images 21474836480 9998
VMS:9999/vm-9999-disk-0.qcow2 qcow2 images 21474836480 9999

pve02:/vmsgluster/images# du -chs *
127G 100
771G 101
68M 102
60G 103
224G 104
74G 105
29G 106
47G 107
119G 108
300G 109 ---------------> this is the VM which has the disk about 1TB (virtual)
197M 9998
321M 9999
1.8T total


Sorry for this long thread!
This is not a issue but I found myself a bit confuse about this.
 
Hello there

I have a VM here with Ubuntu Focal.
The root disk lay down in a LVM group which has the site about 1TB.
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vgcloud-root 982G 654G 279G 71% /

Assuming this is from inside Ubuntu I guess the majority of the (virtual, but seen inside Ubuntu as physical) disk is used as lvm-group.
"Used" means occupied by files as the filesystem on it reports.

But when I get the information about disk size using qemu-img, surprisely I get other results.

qemu-img info /vmsgluster/images/109/vm-109-disk-1.qcow2
image: /vmsgluster/images/109/vm-109-disk-1.qcow2
file format: qcow2
virtual size: 0.977 TiB (1073741824000 bytes)
Quite correct: ~ 1TB defiened virtual disk size
disk size: 299 GiB
But only 299GB space of physical disk (seen the gluster-fs as just one physical disk in this context) is really used for the qcow2 file.
Note: the value is not necessary identical to the "used" space in the VMs subsystem since qcow2 format has it's own logic how to compress data.
cluster_size: 65536
Format specific information:
compat: 1.1
compression type: zlib
lazy refcounts: false
refcount bits: 16
corrupt: false
extended l2: false

So I am a bit confuse.
The disk size is related to the Avail data inside the VM?

And worst, when I checked the storage in Proxmox I get this:
Filesystem Size Used Avail Use% Mounted on
gluster2:VMSGLUSTER 5.9T 327G 5.6T 6% /vmsgluster

If I list the storage I get:
pvesm list VMS
Volid Format Type Size VMID
VMS:100/vm-100-disk-0.qcow2 qcow2 images 107374182400 100
VMS:101/vm-101-disk-0.qcow2 qcow2 images 42949672960 101
VMS:102/vm-102-disk-0.qcow2 qcow2 images 34359738368 102
VMS:102/vm-102-state-snap-13042023.raw raw images 4003732480 102
VMS:103/vm-103-disk-0.qcow2 qcow2 images 107374182400 103
VMS:103/vm-103-state-teste.raw raw images 1776717824 103
VMS:104/vm-104-disk-0.qcow2 qcow2 images 322122547200 104
VMS:105/vm-105-disk-0.qcow2 qcow2 images 21474836480 105
VMS:105/vm-105-disk-1.qcow2 qcow2 images 274877906944 105
VMS:106/vm-106-disk-0.qcow2 qcow2 images 21474836480 106
VMS:106/vm-106-disk-1.qcow2 qcow2 images 1073741824000 106
VMS:107/vm-107-disk-0.qcow2 qcow2 images 21474836480 107
VMS:107/vm-107-disk-1.qcow2 qcow2 images 64424509440 107
VMS:108/vm-108-disk-0.qcow2 qcow2 images 21474836480 108
VMS:109/vm-109-disk-1.qcow2 qcow2 images 1073741824000 109

This shows the logical size which is ~ 1TB

VMS:9998/vm-9998-disk-0.qcow2 qcow2 images 21474836480 9998
VMS:9999/vm-9999-disk-0.qcow2 qcow2 images 21474836480 9999

pve02:/vmsgluster/images# du -chs *
127G 100
771G 101
68M 102
60G 103
224G 104
74G 105
29G 106
47G 107
119G 108
300G 109 ---------------> this is the VM which has the disk about 1TB (virtual)

Quite correct it shows the physically occupied space (299GB and 300GB can be considered as the same value)
 
since qcow2 format has it's own logic how to compress data.
So this is all about qcow2 or raw compress?
And I am bring raw here because the disk was restored from a backup were the virtual disk was raw (from a LVM-thin in the old server).
I changed it to qcow2 in hope to make clear to understand what's going on.
But that's ok. This is not dangerous in any way.
Thanks
 

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!