I’ve recently started buying M.2 drives instead of traditional 2.5” SSDs. For USB enclosures I went with a UGREEN M.2 NVMe USB3.2 Gen2 enclosure that comes with all the bells and whistles. They have a Realtek RTL9210 chip which does support the “discard” or TRIM operation to mark unused space on the SSD. However, some Linux variants don’t properly detect this capability. To help with that, you can add a udev rule in /etc/udev/rules.d/
as explained in this forum post:
# Turn on "unmap" mode to allow "fstrim" et al. on USB-C/NVMe adaptors
# 0bda:9210 Realtek Semiconductor Corp. RTL9210 M.2 NVME Adapter
ACTION=="add|change", ATTRS{idVendor}=="0bda", ATTRS{idProduct}=="9210", SUBSYSTEM=="scsi_disk", ATTR{provisioning_mode}="unmap"
Code language: PHP (php)
To activate this without a reboot, run sudo udevadm trigger
. After that, fstrim
should start to work with this drive.
By now I have 2 of those Ugreen M.2 NVMe USB 3.2 SSD enclosures. One of them is attached to my DELL monitor which…
Pingback: RTL9210 NVMe Enclosure Firmware Update – blog.mbirth.uk
Does this work on other chipsets that should support it but don’t expose it? E.g JSM?
You should be able to set the `unmap` flag with any USB adapter – just adapt the vendor and product ids to your device. Not sure whether it’ll actually do a TRIM, though.