Skip to content

Instantly share code, notes, and snippets.

@malakudi
Last active August 19, 2019 09:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save malakudi/b6509568c440054440d0b68b5efb0b1e to your computer and use it in GitHub Desktop.
Save malakudi/b6509568c440054440d0b68b5efb0b1e to your computer and use it in GitHub Desktop.
Enable trim support for external UAS device that is not enabled automatically
ACTION=="add|change", ATTRS{idVendor}=="152d", ATTRS{idProduct}=="0578", SUBSYSTEM=="scsi_disk", ATTR{provisioning_mode}="unmap"
ACTION=="add|change", ATTRS{idVendor}=="152d", ATTRS{idProduct}=="0578", SUBSYSTEM=="block", ATTR{queue/discard_max_bytes}="16777216"
Second line was needed for my device because it could not handle TRIM with larger than 16MB blocks (automatically detected as 4GB), it would give CDB errors like:
kernel: sd 10:0:0:0: [sda] tag#25 CDB: Unmap/Read sub-channel 42 00 00 00 00 00 00 00 18 00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment