[SOLVED] FSTrim and Discard needed on ZFS?

Jul 16, 2018
20
1
1
33
Uruguay
www.netuy.net
Hello!

We have a couple of servers configured to use local ZFS pools for storage. These pools have Thin Provisioning enabled.
I used to think that Thin Provisioning + ZFS was enough to have the VMs use on physical storage the same space that they are using into themselves, but it seems I was wrong.
Just to check if I am right, Thin Provisioning only enables the virtual disks to grow according to the needs of the VM, but it does not shrink it, correct? Pretty much link Dynamic VHDs on Hyper-V.
If I want to have the VMs use the least physical disk space needed I have to set them with the Discard option enabled on they disks and also run fstrim periodically on them. Am I right?
And I have one more doubt, the disk space that is grown on the virtual disk but is not actually used on the VM, does it get replicated too? Or replication skips that space? If the "empty" space on the virtual disks is replicated then I guess shrinking the virtual disk should help to improve replication performance, correct?

Thank you very much, any advice is welcome!

Best regards,

Juan
 
Hi jmcorrea,

All thin allocated storages have to run fstrim inside the VM.
And if you run FStrim you must enable discard on the vdisk.
With this flag, FStrim is able to send the erased blocks to the storage layer.

I just learned, ZFS discard/trim won't happen till 0.8?
What you mean is trim for the ZFS itself.
This has nothing to to with thin allocated disks.
 
With this flag, FStrim is able to send the erased blocks to the storage layer.

As long as this has not changed, you also need to use SCSI virtio in order to get TRIM to work.

Just to check if I am right, Thin Provisioning only enables the virtual disks to grow according to the needs of the VM, but it does not shrink it, correct?

No, that is exactly why you have to run TRIM inside of your guest (with all the settings @wolfgang and I said).
 

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!