Thin Provision

dthompson

Well-Known Member
Nov 23, 2011
146
14
58
Canada
www.digitaltransitions.ca
Hi all,

I'm trying to figure out how to have my virtual hard drives run efficiently on thin provision volumes. I have a 4 node setup with all 10GB Backend for VM's and Containers mounted on each node.

The storage is mounted via NFS
The backend storage (Various QNAPs) are all created as thin provision volumes.
The Guest data all resides on the thin provisioned volumes on NFS storage.
On the guest hard drives, I have them set as Discard, however I cannot enable the SSD Emulation as its greyed out.
If I migrate a 1TB drive from one storage array to another one, even if its using only 200GB of data, once its migrated on to the other storage array its how utilizing the entire 1TB of space.

My question is the following:
1.) How do I enable SSD Emulation on existing drives. Not sure if i need this, but the wiki page about seemed to suggest that it might need to be.
2.) The servers effected are debian / ubuntu servers ranging from debian 9 to ubuntu 18.04
3.) All guests have the qemu-drivers installed. Not sure if there is anything else I need to do in order to configure it to let the guest know that trim needs to be done when data is discarded.

The set size only happens during a migration. When it sits on the initial storage unit that it was created on, the virtual disk will only use up the actual amount of storage in use, even if the disk is presented to the guest as a 1TB disk.

Can someone please give me a hand in figuring this out as I'd like to migrate disk between storage arrays and not have them take up the actual amount once the disk are used, but only the actual amount they are currently using.

I've searched the forums, but nothing seems to be in line with the issue I am seeing with thin provisioned drives and NFS.

Thank you!
 
My question is the following:
1.) How do I enable SSD Emulation on existing drives. Not sure if i need this, but the wiki page about seemed to suggest that it might need to be.
You do not. SSD Emulation has nothing to do with TRIM/Discard. The only thing it does is tell the guest that the rotational speed of the given drive is 0, which most guest OS pick up as "that's an SSD", but usually it doesn't change behaviour. If you need it, change the drive bus to something other than VirtIO block (e.g. scsi, sata)

3.) All guests have the qemu-drivers installed. Not sure if there is anything else I need to do in order to configure it to let the guest know that trim needs to be done when data is discarded.
Make sure "fstrim_cloned_disks" is enabled in your VM's agent options.

The reason your disks no longer appear thin-provisioned after a migration is that during the disk move all sectors are copied, even zeroed/discarded ones. The NFS server has to pick this up as a write to the entire file, since all it sees is regular file writes to your qcow2/raw images. Theoretically, NFSv4.2 supports hole-punching which might make a difference, but you'd have to test that and make sure your file storages also support it.

The important part is that your entire stack has to support TRIM/Discard, from the Guest OS (which needs to know what to discard) all the way down to the backing store - in your case NFS, which needs to know how to handle the discard requests.
 

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!