[linux-lvm] Expectations for TRIM on an MD→LVM→Xen→? stack

Andy Smith andy at strugglers.net
Mon May 18 21:21:17 UTC 2015


This is a purely hypothetical setup at this point but I am wondering
what to expect in the way of TRIM support through all these layers.

Let's say: Debian 8.0 (jessie) host machine with SSDs in MD RAID-10,
MD device used as PV, and then Xen PV VMs using LVs as their disks.
I will have no idea how the administrators of the VMs will lay out
their storage; they might treat them as disks and partition them, or
directly put filesystems on the block devices, or even use them as
LVM PVs themselves.

As far as I can see:

- MD supports TRIM on RAID-10 from kernel 3.7:


- LVM supports TRIM if issue_discards is set:


- Xen supports TRIM on PV block device since kernel 3.2:


So, I think the situation would be something like:

- If the admin of the VM sets it up to do TRIM by e.g. using the
  discard fstab option or issuing fstrim commands, then the TRIM
  commands should be passed all the way down and honoured.

- There will be nothing I as the operator of the bare metal machine
  can do to either force or deny TRIM for the underlying storage of
  those LVs other than to disable it in LVM. So if the VM admin does
  not configure TRIM, there will be no TRIM.

- Once a VM is decommissioned and an lvremove is done from the
  hypervisor host, we could expect TRIM to take place.

Are these assumptions correct?

If I ran blktrace on the MD member device (e.g. /dev/sda5), would I
see a TRIM command propagated down from a VM? What would that look


More information about the linux-lvm mailing list