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"
To activate this without a reboot, run sudo udevadm trigger
. After that, fstrim
should start to work with this drive.
Pingback: RTL9210 NVMe Enclosure Firmware Update – blog.mbirth.uk