USB NVMe adapter trim/discard support

I have a Realtek RTL9210-based USB to M.2 NVMe/SATA adapter and I’ve always been frustrated that it didn’t support trim or discard abilities. For example, it’s never been able to run the blkdiscard command to quickly erase an M.2 flash drive.

It turns out it does support trim/discard, I just needed to manually enable it! Now I can blkdiscard both NVMe and SATA M.2 sticks.

The details which opened my eyes to this are on the Gentoo wiki: Discard over USB - Gentoo wiki

I just needed a udev rule like this to make it work, none of the math used in that wiki article was required:

ACTION=="add|change", ATTRS{idVendor}=="0bda", ATTRS{idProduct}=="9210", SUBSYSTEM=="scsi_disk", ATTR{provisioning_mode}="unmap"
1 Like