device-mapper: thin: Data device (dm-2) discard unsupported: Disabling discard passdown

Kurgan

Renowned Member
Apr 27, 2018
54
10
73
Hi everyone.

I noticed this message in the PVE host kernel.

The host is an old Dell server with a PERC/6i and 2 RAIDs: one RAID1 of SSDs and one RAID5 of HDDs.

PVE is installed with the standard LVM thin configuration.

I have enabled discard as I usually do on a Linux guest, and got this error which seems to be quite clear to me: something down the line does not allow the discard request to be relayed from the guest to the host to the virtual disks to the physical disks. Which could make sense on the HDDs, but not so much on the SSDs.

Is it LVM or is it the controller that's causing this issue? Will this mean that my SSDs will never get the discard commands?
 
You can see if the RAID controller is telling the kernel that discard is supported. Run this to see how many bytes it says can be discarded in one pass

Code:
cat /sys/block/sdz/queue/discard_max_hw_bytes

Replace sdz with your actual device. If this is 0, the raid controller is telling the kernel that discard is not supported.

It is common for RAID controllers to just not bother with discard. A lot of modern SSDs work around this internally by having some extra reserve blocks to use. This will work for most work loads that aren't too write-heavy. You might be able to get discard to work through the RAID card's settings, or by setting the drives into JBOD mode (this will lose all data on the RAID obviously) and then building the raid in software instead (zfs raid for example).