De-allocation problem on host disk space using VMs with qcow2/vmdk disk formats

May 25, 2016
5
0
1
37
If a VM is build using qcow2 or vmdk HDD format with size say 1TB and fill it up completely, it uses 1TB of Proxmox server disk space, but when you delete files from VM, it does not de-allocate HDD space and still 1TB of disk is used on Proxmox disks.

I faced this problem on 4.0 and 4.2 PVE. Storages are added in "Directory" and "LVM -Thin" and nothing changed.
 
This is because the system underneath (filesystem, lvm, zfs, etc) doesn't know when a file was deleted inside the VM. For this the option discard exists, this option tells the system underneath that block can be freed.
https://pve.proxmox.com/pve-docs/pve-admin-guide.html#qm_virtual_machines_settings
Thanks dear Alwin for your help. So, as far as I understand, we had to use storage types which supports snapshots (because we need it supports thin provisioning and proxmox documentation says storage which support snapshots, supports thin provisioning as well) and VM created with SCSI controller (with tick Discard option). Is that right?

We have several Proxmox VE servers with different versions. For example I tested on one of our server with PVE 4.0-48. Apparently, that version of PVE does not support LVM-thin. we've added our local storage as Directory. According to Proxmox documentations, directory storage type does not support thin provisioning so we can not use Discard option, but when I'm creating new VM, I can see Discard option which is not grayed out even with IDE or SATA or VIRTIO buses. Is that mean we can use this feature in Directory type storage with those buses or is documentation is outdated or something?
Related screenshots attached to the post.Discard-option-is-enabled-on-all-type-of-buses.png PVE-4.0-does-not-support-LVM-Thin.png
 
The SCSI controller can forward the discard events to the underlying storage.

  • the QEMU image format is a copy on write format which allows snapshots, and thin provisioning of the disk image.

  • the raw disk image is a bit-to-bit image of a hard disk, similar to what you would get when executing the dd command on a block device in Linux. This format do not support thin provisioning or snapshotting by itself, requiring cooperation from the storage layer for these tasks. It is however 10% faster than the QEMU image format.

  • the VMware image format only makes sense if you intend to import/export the disk image to other hypervisors.
Taken from the same link above. ;) I hope this answers your question.
 

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!