I have an SSD (Samsung 860 EVO) attached via an USB-SATA adapter (I tried both this one and this one) to an ARM computer (Odroid N2) running Armbian (Linux 4.9.180).

I partitionned it with LVM (simple setup: a single PV, VG, and LV; no encryption). But when I mount it, I get this warning in dmesg:

[87990.092895] EXT4-fs (dm-0): mounting with "discard" option, but the device does not support discard

and fstrim fails:

# fstrim /var/lib/postgresql 
fstrim: /var/lib/postgresql: the discard operation is not supported

I checked, and hdpart indicates that the hardware should support TRIM:

# hdparm -I /dev/sda | grep TRIM
       *    Data Set Management TRIM supported (limit 8 blocks)
       *    Deterministic read ZEROs after TRIM

lsusb and dmesg confirm this is an UAS/SCSI device:

# lsusb -t
/:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci-hcd/1p, 5000M
    |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/4p, 5000M
        |__ Port 3: Dev 5, If 0, Class=Mass Storage, Driver=uas, 5000M
# dmesg
[87893.325796] scsi host0: uas
[87893.337014] scsi 0:0:0:0: Direct-Access     Samsung  SSD 860 EVO 500G 3202 PQ: 0 ANSI: 6
[87893.394341] sd 0:0:0:0: Attached scsi generic sg0 type 0
[87893.394928] sd 0:0:0:0: [sda] 976773168 512-byte logical blocks: (500 GB/466 GiB)
[87893.394938] sd 0:0:0:0: [sda] 4096-byte physical blocks
[87893.395718] sd 0:0:0:0: [sda] Write Protect is off
[87893.395729] sd 0:0:0:0: [sda] Mode Sense: 53 00 00 08
[87893.396153] sd 0:0:0:0: [sda] Disabling FUA
[87893.396163] sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[87893.396322] xhci-hcd xhci-hcd.0.auto: ERROR Transfer event for disabled endpoint or incorrect stream ring
[87893.396331] xhci-hcd xhci-hcd.0.auto: @00000000cf6128b0 00000000 00000000 1b000000 03078001
[87893.396593] sd 0:0:0:0: [sda] Optimal transfer size 33553920 bytes not a multiple of physical block size (4096 bytes)
[87893.401435]  sda: sda1
[87893.404218] sd 0:0:0:0: [sda] Attached SCSI disk
[87990.092895] EXT4-fs (dm-0): mounting with "discard" option, but the device does not support discard
[87990.092901] EXT4-fs (dm-0): mounted filesystem with ordered data mode. Opts: discard

But lsblk indicates the device does not support DISCARD/TRIM ("in DISC-GRAN and DISC-MAX [...] non-zero values indicate TRIM support"):

# lsblk --discard
sda                     0        0B       0B         0
`-sda1                  0        0B       0B         0
  `-vg0-pg_data0        0        0B       0B         0

Edit: I tried connecting the disk+adapter to a different computer; results are the same (except there are no errors in dmesg)

What should I do to enable support for TRIM/DISCARD/fstrim?

  • This is likely some of the problem “ERROR Transfer event for disabled endpoint or incorrect stream ring” – Ramhound Jul 6 '19 at 22:49
  • I just tried with a different computer. This error does not appear, but I still can't use fstrim. – Valentin Lorentz Jul 7 '19 at 14:31

I did not manage to make these particular adapters pass TRIM commands, but I did find a solution.

First you need an adapter using a JMicron JMS578 chip. I found two: hardkernel's Bridge Board Plus (you need the "Plus" one), or this one I found on amazon.

I only tried the latter (cheaper and quicker for me to get), but odroid's forum reports the same procedure works for the former.

You must then upgrade the firmware of the JMS578 (these instructions only work for an armhf system, though it may work with an emulator):

wget https://wiki.odroid.com/_media/odroid-xu4/software/jms578fwupdater.tgz
tar xzf jms578fwupdater.tgz
cd jms578fwupdater
./JMS578FwUpdate -d /dev/sda -f ./JMS578-Hardkenel-Release-v173.01.00.02-20190306.bin -b ./backup.bin

Hardkernel's wiki page gives more details about how to use it, and other features.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.