[SOLVED] Trim not working on a USB 3.0 drive

What if you add discard to options in the last fstab line?

I had a spare SSD lying around so I tried to run trim through one of these:

No problems. All trimmed ready to go.

1 Like

that seems clear that discard (trim) in not supported with his USB drive. to add discard in fstab won't change this fact,
like as said @tbg there is some (rare) USB controller (drive side) that support "trim" I think they use UNMAP command that is kind of equivalent for SCSI. TRIM is a sata command.
it's even nowadays impossible to use trim on some pci-express SSD

If the controller doesn't support trimming then I'm not sure it would make much difference.

I could think of one solution that i find personally repugnant. Format as NTFS and let a Windows machine do the required trimming and defragging. Unfortunately, that doesn't maintain proper file permissinsions required for system backups. Fine for large movie and music collections, but not so good for what the OP wants.

I've got to go wash up now. I can't believe I just suggested a Windows based solution.

Exactly.

Excerpt from first link:

Of the five USB to SATA chips I tested, only Jmicron's JMS 578 can support Trim. To make Trim effective also need to be implemented under the UASP support of Windows 8 and above operating systems. If you find that other chips can also support Trim welcome to add ~

Newer Linux kernels include UASP (USB Attached SCSI Protocol) support so it might be inferred that with the right controller chip it is possible now.

See links below:

http://bbs.pceva.com.cn/thread-125643-1-1.html

https://www.reddit.com/r/archlinux/comments/4rf3ey/uasp_usb_30_to_sata_iii_ssd_enclosures_that_work/

http://linux-sunxi.org/USB/UAS#UASP_capable_chipsets_in_disk_enclosures

https://bbs.archlinux.org/viewtopic.php?id=207621

This is a manufacturers site but it has some excelent information about trim support with USB3 & UASP.

All You Need to Know About UASP

1 Like

@tbg
@scachemaille
@anon23612428
All the SSDs I use are of the Samsung 850 Evo series: this series supports Trim, as the 250, 500 & 1000GB SSDs can all be trimmed as internal drives on the laptop I use.

When it comes to the external drive, the USB3.0 drive we're discussing here (1000GB Samsung 850 Evo SSD), you mention a USB controller - are you referring to the enclosure (caddy) that the SSD is plugged into, i.e. the interface hardware between the external SSD and the USB3.0 port of the laptop?

Thanks for your reply: I haven't tried this as I prefer to trim manually with fstrim, to reduce wear on the SSD.

Yes that is correct.

Does your laptop by chance have an esata port. Mini drive caddy's with esata ports can be had for a little as $8.99 on Amazon. I much prefer esata to USB anyways, and I think trim is generally supported on esata. Firewire also supposedly supports TRIM, so that might be another option if your laptop happened to have a port.

1 Like

Yes, the SSD itself supports Trim, but it's the conversion chip SATA->USB that's probably preventing the Trim command from getting through.

A possible alternative would be to get a 2.5" drive bay directly connected to the SATA port on the mainboard, where you can slide your SSD in and access it like an internal drive. I don't know if that's what you want though. And some SATA controllers don't support hotswap.

1 Like

Sadly, no - it doesn't have firewire either.
However, it does have thunderbolt-connectivity - are external drives with this TRIM-compatible?

From what I was reading I think they are. But what I also found out is the controller on your mobo actually has to support UASP as well. Being newer and not a cheaper laptop yours may.

1 Like

That's good news. I found this on Amazon - is this what you have?
https://www.amazon.co.uk/s/ref=nb_sb_noss?url=search-alias%3Daps&field-keywords=IDE+SATA+HDD+Hard+Drive+Disk+Dock+Docking+Station+All+In+1+Clone&rh=i%3Aaps%2Ck%3AIDE+SATA+HDD+Hard+Drive+Disk+Dock+Docking+Station+All+In+1+Clone

Many thanks tbg - I'll look into it.

1 Like

Apparently Apple supports trimming via thunderbolt OOTB.

Following on from what you mentioned, I found this website:

Using the information on this site, I then checked to see if the UASP driver is installed - this will be shown as Driver=uas. Unfortunately, it is not there, but have Driver=xhci_hcd/6p instead:

[mike@G750 ~]$ lsusb
Bus 002 Device 002: ID 8087:8000 Intel Corp. 
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 002: ID 8087:8008 Intel Corp. 
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 003: ID 13d3:5188 IMC Networks 
Bus 003 Device 002: ID 8087:07dc Intel Corp. 
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

[mike@G750 ~]$ lsusb -t
/:  Bus 04.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/6p, 5000M
/:  Bus 03.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/14p, 480M
    |__ Port 5: Dev 2, If 1, Class=Wireless, Driver=btusb, 12M
    |__ Port 5: Dev 2, If 0, Class=Wireless, Driver=btusb, 12M
    |__ Port 7: Dev 3, If 0, Class=Video, Driver=uvcvideo, 480M
    |__ Port 7: Dev 3, If 1, Class=Video, Driver=uvcvideo, 480M
/:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/2p, 480M
    |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/8p, 480M
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/2p, 480M
    |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/6p, 480M

Can't remember if I mentioned it, but the laptop is an Asus G750JS (CPU i7-4010HQ), made in 2014, so yes it's relatively new. Even though UASP driver doesn't seem to be in the machine, file transfer rates between the internal SSD and the external one is still very fast, and is at times maxing out at a bit more than 500MB/s, though is typically between 300 & 450 MB/s for a mix of different file types & sizes. I think 500MB/s is close to the write-speed limit for this make of SSD.

Well as far as I can see you don't have many options then. The best one would involve swapping the drive out periodically to a desktop Linux box if you have one. They sell mini drive caddies with swing open tops that you can easily pop an SSD drive in and out of in seconds.
If you have a desktop box with estata you could then get a hot swap dock with estata to trim the drive occasionally. Hardly ideal, but it's about the only thing I can think of that wouldn't be a major headache of disassembly reassembly simply to perform a trim operation now and then.

If you don't work out some kind of system for periodic trim then there won't be much point in using an SSD for storage. After a while it will slow down to slug speed as the drive fills with deleted clutter. Unfortunately, this appears to be one of those cases where the hardware hasn't become common enough except on newer computers to support this. Too bad.

1 Like

@tbg
Really appreciated the discussions here - very helpful even if I haven't as yet been able to sort out the Trim side of things. I think Hipster's idea & experience with a drive docking station (reply #16) is a really good one. I've had a look on Amazon and there seem to be a few which look pretty similar.

Of course, the other thing I could do is to periodically clone the internal data-only SSD to the external backup. That way the cumulative mess,caused by repeated file deletions, will not occur.

If I find anything that works I'll post it on the forum, re. a USB controller, etc. Many thanks again :sunglasses:

I have 2 mediasonic 4bay hot wap docking stations that have USB 3 and esata ports. I use esata and its controler works well on linux. I also have 2 thermaltake blackX 2bay docking stations their controlers I've had issues with. I wouldn't recommend the thermaltake one's, but the mediasonic one's are great. Best of luck.

1 Like

Yep that's the one. Install it with -S pcsclite ccid. Easy.

Only drawback with this one is that I could not get it to work with ide. It is a cheapy though.

I've never tried the cloning feature. Would rather use clonezilla. Don't even know if cloning works in linux.

1 Like

Forum kindly sponsored by