Title. I need a USB 3 to SATA adapter to use a spare 2.5" SSD with a machine that doesn’t have any spare SATA ports and no place to put it at this point.

I’ve read that most of these adapters have issues with supporting TRIM on Linux. I need one that supports TRIM.

So any recommendations for something that will survive reboots which I’m planning to use for semi-permanent game storage?

An enclosure style is fine.

(Note: I too can search Amazon. When looking into the reviews from Linux users most of the adapters that claim to work with Linux have people clarifying TRIM doesn’t work.)

  • Brickfrog@lemmy.dbzer0.com
    link
    fedilink
    arrow-up
    5
    ·
    edit-2
    15 hours ago

    Your post title and post body are asking for two different things :P Tons of SATA to USB adapters and drive enclosures work well on Linux, that part isn’t too difficult.

    But what you probably want is one that has both UASP support and TRIM support for best SSD support. Here’s the tricky part, even if the adapter or drive enclosure has TRIM support that doesn’t mean it was auto enabled in the Linux system it was plugged into. Often times Linux can’t tell if an adapter or drive enclosure has TRIM support so the safe thing to do is to not enable it by default. That means you can see the drive supports TRIM, hdparm says the drive supports TRIM, yet when you run fstrim it still complains that TRIM isn’t supported.

    Take a look at

    https://wiki.archlinux.org/title/Solid_state_drive#External_SSD_with_TRIM_support

    and https://glump.net/howto/desktop/enable-trim-on-an-external-ssd-on-linux

    If you already have an external adapter or enclosure that claims TRIM support but it isn’t working in Linux maybe try to enable TRIM and see how it goes?

    For what it’s worth I do have a drive enclosure, with ASMedia ASM1351 chipset, that claims TRIM and UASP support but by default fstrim still won’t run TRIM on any drives inside it. If I get some free time maybe I’ll see if I can get Debian to enable TRIM on the device just for testing but it could be a bit.

    EDIT: Confirmed the instructions in archlinux seem to work and I was able to temporarily enable TRIM on my external drive enclosure to successfully run fstrim on an SSD inside it. I only did a quick test, setting provisioning_mode to “unmap” so it’ll lose TRIM configuration once I disconnect the drive or restart the system. You’ll probably want to go the extra step and set up udev rules to keep it enabled.

    Tested on Debian with a Startech S251BMU313 (USB 3.1 enclosure for 2.5" SATA drives with ASMedia ASM1351 chipset). In theory the archlinux instructions should work with any external USB adapter or enclosure with TRIM support.

    Also note the instructions are a bit confusing, I did notice that running sg_readcap immediately resets the configuration in provisioning_mode so in my case I had to avoid re-running sg_readcap after enabling “unmap”.

    EDIT2: Forgot one important tidbit :P for whatever reason the actual echo “unmap” command in archlinux would not work for me, I think you may need to have root permissions to actually do that? Instead I ran this with my non-root admin user:

    echo unmap | sudo tee /sys/block/sdX/device/scsi_disk/*/provisioning_mode
    

    Replace sdX with the drive device you’re working with. I’m not entirely sure why the above command works for me in Debian, and not the archlinux version, but figured I’d document it here just in case.