Page 1 of 1

Re: SSD TRIM - the discard operation is not supported

Posted: Wed Oct 09, 2019 7:07 pm
by Kendek
If your adapter supports the UNMAP/TRIM, you need the following udev rule to activate:

/etc/udev/rules.d/01-unmap.rules

Code: Select all

ACTION=="add|change", ATTRS{idVendor}=="<VID>", ATTRS{idProduct}=="<PID>", SUBSYSTEM=="scsi_disk", ATTR{provisioning_mode}="unmap"
You can read the VID and PID from the lsusb output.

Re: SSD TRIM - the discard operation is not supported

Posted: Wed Oct 09, 2019 9:08 pm
by logcabin
The hdparm package contains a (somewhat risky) script, which on my system is here:

/usr/share/doc/hdparm/wiper/wiper.sh.gz

I've never had it fail, but I'd strongly advise backing up whatever disk you want to trim. You can run it on a live file system, but the author recommends running it on the underlying device when the system is running from a different root. I've run it both ways and haven't had a problem.

Re: SSD TRIM - the discard operation is not supported

Posted: Thu Oct 10, 2019 9:41 pm
by HawaiianPi
jcyr wrote:
Wed Oct 09, 2019 8:24 pm
Appears the Asmedia adapter doesn't support the unmap command!!!
Which Asmedia adapter (brand/model)? I ask, because the one I'm using does (Eluteng with blue SATA port).

Code: Select all

~$ sudo fstrim --fstab --verbose
/: 228 GiB (244818563072 bytes) trimmed on /dev/sda2
/mnt/boot: 213 MiB (223357440 bytes) trimmed on /dev/sda1
/boot: 14.4 GiB (15432482816 bytes) trimmed on /dev/mmcblk0p1

FYI: lsusb shows the same as yours.

Code: Select all

Bus 002 Device 002: ID 174c:55aa ASMedia Technology Inc. Name: ASM1051E SATA 6Gb/s bridge, ASM1053E SATA 6Gb/s bridge, ASM1153 SATA 3Gb/s bridge, ASM1153E SATA 6Gb/s bridge

Buster Lite:
Linux Pi4B2SSD 4.19.75-v7l+ #1270 SMP Tue Sep 24 18:51:41 BST 2019 armv7l GNU/Linux

Image written to SSD with Etcher and files from "boot" partition copied to FAT32 formatted micro SD card.
Micro SD card mounted as /boot in /etc/fstab (and SSD "boot" partition mounted in /mnt/boot).
Silicon Power A55 256GB SATA-III SSD with Eluteng blue USB 3.0 adapter cable.
Older official Pi3 PSU with USB-C adapter.

Re: SSD TRIM - the discard operation is not supported

Posted: Thu Oct 10, 2019 10:12 pm
by HawaiianPi
jcyr wrote:
Thu Oct 10, 2019 10:06 pm
I didn't use the --fstab parameter on the fstrim command. Wonder if that matters?
That just tells it to test all filesystems mounted in /etc/fstab.

Re: SSD TRIM - the discard operation is not supported

Posted: Fri Oct 11, 2019 3:47 am
by Kendek
jcyr wrote:
Fri Oct 11, 2019 12:08 am
@HawaiianPi: I think I've found a possible explanation why yours works and mine doesn't.
It also depends on the firmware, but the minimum is ASM1351. If you want to be sure, use a StarTech product. I have some cable-style adapters, the USB312SAT3CB is working properly (with the official firmware update). You can find it on eBay, and not that expensive.

Encrypted WD20SPZX SMR HDD:

Code: Select all

> hdparm -I /dev/sda | grep TRIM
           *Data Set Management TRIM supported (limit 10 blocks)
           *Deterministic read data after TRIM

> lsblk -D /dev/mapper/data
NAME DISC-ALN DISC-GRAN DISC-MAX DISC-ZERO
data        0        4K       4G         0