[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


Hi,

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:

  http://kernelnewbies.org/Linux_3.7#head-2fd9b183a4623d96e69ed24f88e0eb83217fa8df

- LVM supports TRIM if issue_discards is set:

  https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Logical_Volume_Manager_Administration/lvmconf_file.html

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

  http://wiki.xen.org/wiki/XenParavirtOps

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
like?

Thanks,
Andy




More information about the linux-lvm mailing list