Turn on "Discard" option?

mn124700

New Member
Feb 22, 2020
15
0
1
51
How important is it to turn on the "Discard" option for VMs when using an SSD drive for storage?

- Eric
 

aaron

Proxmox Staff Member
Staff member
Jun 3, 2019
2,112
279
88
If you have a storage underneath that supports thin provisioning and zeroing of unused space (ZFS, Ceph, I think thin LVM) then it helps to pass through the discard/trim commands to the actual storage to reclaim unused space.
 
Jan 6, 2021
71
10
8
45
Thanks Aaron, And this is regardless of which vm hard disk type is used (ide/scsi) of the guest vm?

So just to be clear, any vm I put on my zfs-raid mirror tank0 should have discard[x] enabled? and I assume ssd emulation.

What are the consequences of not doing this, the drive will fill up even if not full, how does one track this? Thanks for any explanation this is new to me.
 

Dunuin

Famous Member
Jun 30, 2020
1,778
369
83
So just to be clear, any vm I put on my zfs-raid mirror tank0 should have discard[x] enabled? and I assume ssd emulation.
I think SSD emulation isn't needed. But yes, if you use ZFS you should always have discard enabled. And remember that you also need to tell the guest OS to use discard.
What are the consequences of not doing this, the drive will fill up even if not full, how does one track this?
Yes, your virtual disks will grow and grow. You can use zfs list to view the zvols. If a zvol ist way bigger than the guest os is reporting used space, your discard might not be working.
 
Last edited:
  • Like
Reactions: entilza

spirit

Famous Member
Apr 2, 2010
4,798
391
103
www.odiso.com
ssd emulation is needed for virtual ide drive, to have discard working on some guest.
if you use virtio or virtio-scsi, you don't need ssd emulation, just enable discard.

Discard is use to free space on your physical storage, you delete a file inside a guest vm for example. without discard, when you delete a file, the space is still used on the the physical storage, so you can't use it in another vm.

(if you don't care about thin provisioning, you don't need discard)
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE 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 your own in 60 seconds.

Buy now!