[PVE-User] Discard transmission between VM / LVM / mdadm layers ?

Simone Piccardi piccardi at truelite.it
Tue Dec 17 17:25:47 CET 2019

Il 15/12/19 12:51, Frédéric MASSOT ha scritto:
> Ben Hutchings answered this about the non transmission of discard by 
> LVM: "This seems to be incorrect. LVM normally uses dm-table, which 
> supports discard if the underlying device(s) do".
> I do not know what to think. Mdadm, the lower layer, supports discard.

Yes, LVM support discards, and they are just passed to the underlying 
disk anyway (lvm-thin is still LVM).

But by using standard LVM on proxmox you allocate a fixed slice of disk, 
not just the disk space you are effectively using. The discard is just 
passed in the underlying disk. But this way you don't have snapshot, nor 
you can overcommit if your VMs are using only a small fraction of their 

When you use lvm-thin the disk space is taken from a data pool volume, 
and the logical volumes used as virtual machine disks only use the disk 
space actually occupied. If you free some of this disk space a discard 
(given calling fstrim inside the VM) also free the unused disk space on 
the virtual disk from the data pool making it available again to other 
logical volumes.

Simone Piccardi                                 Truelite Srl
piccardi at truelite.it (email/jabber)             Via Monferrato, 6
Tel. +39-347-1032433                            50142 Firenze
http://www.truelite.it                          Tel. +39-055-7879597

More information about the pve-user mailing list