# USB to SATA Bridges

## NeddySeagoon

Team,

I have a USB powered USB3.1 to SATA bridge that I use ta attach an SSD to a Raspberry Pi.  The Pi does not power the SSD.

The SSD supports trim but the USB to SATA bridge does not. I suitably panned it in my Amazon review :)

I can work around the missing trim by fitting the SSD to a computer without the USB bridge, mounting the filesystems and running fstrim.

So far so good.  It a bit of a faff but should work.

However, swap is on the SSD too. It not mounted, its not a filesystem ... how do I trim that?

The raspberry Pi can use a lot of swap too.

If anyone knows a USB3 to SATA bridge that deals with SSDs properly, I would be pleased to hear about it.

----------

## Maitreya

 *NeddySeagoon wrote:*   

> ...
> 
> However, swap is on the SSD too. It not mounted, its not a filesystem ... how do I trim that?
> 
> The raspberry Pi can use a lot of swap too.
> ...

 

You don't. You can't as there is no record left of what was written.

And the usb conversion removes discard support as well.

Maybe try blkdiscard

----------

## s4e8

Some bridge with proper firmware support TRIM, through you need access it using UAS driver.

```

# sdparm -i --page=lbpv /dev/sdh

    /dev/sdh: TOSHIBA   THNSNS128GMCP     0   

Logical block provisioning (SBC) VPD page:

  Unmap command supported (LBPU): 1

  Write same (16) with unmap bit supported (LBWS): 0

  Write same (10) with unmap bit supported (LBWS10): 0

  Logical block provisioning read zeros (LBPRZ): 0

  Anchored LBAs supported (ANC_SUP): 0

  Threshold exponent: 0

  Descriptor present: 0

  Minimum percentage: 0

  Provisioning type: 0

  Threshold percentage: 0

```

----------

## NeddySeagoon

Maitreya,

I've discovered that swap is mounted with discard options automatically, so while I'm running fstrim, I can do a swapon too.

Unfortunately, it will need to be every boot, or ever more often as swap is used a lot on  a Raspberry pi.    

s4e8,

I'm not using the UAS driver as far as I know.  I'll look into it.

That. would be a much better solution.

Thank you both.

----------

## wildhorse

I replaced my first Raspberry Pi with a Banana Pi a long time ago. By now I have a little farm of Banana Pi (model 1!), Pro and Router (all running a kernel version 4.11). If that is an option for you, then be careful, because a later model (3?) of the Banana actually comes with an internal USB to SATA bridge. Personally, I find life too short for bad wine and USB-SATA bridges.

----------

## NeddySeagoon

wildhorse,

When I can get a real arm64 system for sensible money in the UK, I intend to get one.

There have been a few that have been stillborn, so I'll use the Pi until then.

It needs to have at least 1G RAM per core.

----------

