QCOW2 in Proxmox 4.2

Konstantinos Damianakis

Active Member
May 14, 2016
5
0
41
51
Hi,

For some reason, QCOW2 appears to be taking the same space as RAW when a new VM is created. In previous versions (3.x) QCOW2 HDD would start from a minimum and then expand, i.e. I would set it to 100GB which would be the maximum and it would grow until that. It looks like in the new 4.2 by default they take the maximum space. Could you please advise? is there a setting that I have missed? I installed from the ISO on a new machine and have created an ext4 filesystem for the VMs that I have mounted to the single machine installation that I used and configured via the GUI as an additional storage. I have limited the lvm to 200GB that I do not use as it only offers RAW options for HDD.

Please let me know if any more information is needed.

Regards,
K.
 
how do you determine the size of the images ?
the storage list shows the size you set, not what it really uses.

here my qcow2 files are only as large as the amount of data is has in it (plus a little overhead)
 
Hi Dominik,

Thank you for this!

I have mounted
/prox2main/

as an ext4 filesystem

/dev/sda4 3.4T 111G 3.2T 4% /prox2main

and under images, on the disk, we have

/prox2main/images/7001# ls -lah

total 4.5G
drwxr----- 2 root root 4.0K May 16 13:37 .
drwxr-xr-x 5 root root 4.0K May 16 15:09 ..
-rw-r----- 1 root root 101G May 16 15:04 vm-7001-disk-1.qcow2

this was created as a 100GB qcow2 image on the ext4 - and only contains the core Ubuntu 16.04 files which should be a max of 5GB.

In the 3.x version of Proxmox the ls -lah would display the 5GB.

Any recommendations on possibly any flags I need to set or perhaps the cache settings affect this when creating a HDD on a new VM?

Do I need to provide any further information?

Regards,
K.
 
as you see in your ls output it says: "total 4.5G" which is correct

ls -lah shows the apparent size and not the real size (this possibly changed between 3.4 and 4)

if you want the real size you have various possibilities:
for example:
Code:
#du -sh *
4.3G    vm-2001-disk-1.qcow2

or

Code:
# ls -lahs
total 4.3G
4.3G -rw-r----- 1 root root 34G May 18 09:59 vm-2001-disk-1.qcow2
 
Hi Dominik,

Many thanks for this!

Mine now shows:

root@prox2:/prox2main/images/7001# ls -lahs

total 4.5G
4.0K drwxr----- 2 root root 4.0K May 16 13:37 .
4.0K drwxr-xr-x 5 root root 4.0K May 18 07:04 ..
4.5G -rw-r----- 1 root root 101G May 16 15:04 vm-7001-disk-1.qcow2

which I presume means I am dealing with just 4.5G out of 101G registered. I guess a question is, if I have a HDD of 2TB, will the OS be able to support more than 20 100GB QCOW2 (as before) provided they are of real capacity of less than 100GB each? Because if that is the case, then I can create a CRON migration job to move them to, say, a different disc if they grow to more than 50GB (say) in real capacity.

Regards,
K.
 
if I have a HDD of 2TB, will the OS be able to support more than 20 100GB QCOW2 (as before)
yes this should work, but be careful with this, because your system will encounter errors when no vm can write anymore because of missing space
 
Hi Dcsapak,

Thank you again for this! Hopefully the cron will work as expected but I understand the risk.

Thank you for explaining how the hard disk size can be seen and how the process works.

Regards,
K.
 

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!