USB-SSD not waking (spinning) up quick enough, causing read/write-errors

The more I think about this, the more I am convinced that this is a USB issue and not a SSD issue: it is not the SSD going to sleep what causes this issue, but the USB controller going to sleep.

However, you seem to have a better idea of what is happening, and a clear understanding of what info we need; I do not want to become a burden here, so I will refrain from posting here.

My best wishes.

4 Likes

Yes the Problem is somehow related to USB.
There is the USB-Port on the Router where the USB-Case is connected
The SATA-SSD-Drive in that USB-Case.

As far as I can tell, this particular USB-Case is able to send the SATA-SSD to sleep.
Or simply turns it off or something like that. This happens 1 Minute after the last access.
I have other USB-Cases which do not do that. Only a specific Hardware-Version of these Kingston USB3.0-Cases does do that.

One Thing I do remember just now: Years ago I used this external USB-Case for Backup.
And I remember that the Acronis Software from the CD I booted from, was unable to wake the drive.
It did detect it, but before I could go through the Backup Settings the drive went to sleep.
After that no more access was possible because the acronis software could not wake the drive.

So I guess now, that the openwrt is able to do that and is actually doing that.
What it does not do, is to wait for the drive to wakeup or it has some other issues with this funktion.

A well-behaved SSD with a well-behaved SSD-to-USB controller should respond almost immediately to a wake request.

That you have had problems with the combination in the past on a different OS strongly suggests that the problem lies with the drive or, more likely, the case.

Without full logs, it is impossible to diagnose further.

Also, the power savings between idle or even average operation are minimal. Assuming you're running the "budget" A400-series SSD, https://www.kingston.com/datasheets/sa400_us.pdf shows ~0.20 W idle, ~0.28 W average. 0.2 (W) * 24 (hrs/day) * 356 (days/year) / 1000 (W/kW) ~ 1.7 kWh/year -- even at US$0.30 per kWh, that's hardly worth worrying about. Similarly, it's negligible if you're running off battery/UPS compared to the router itself.

3 Likes

I also wrote that I had this combination running on my previous DLNA Server for many years without any problems. There is no problem with this drive or usb case. Its just that the device it is connected to has to support the sleeping function.

Also the power saving is about 90%, I checked it myself.

There's a package called luci-app-hd-idle that you might try if you haven't already, i don't use it, but it should let you control when your drives sleep or not (i think). Also, if your case is usb3 you might also install kmod-usb-storage-uas, i'm not too familiar with it either, but its apparently needed for some extra usb3 functionalities.

I tried some of these before.
As you can read in the Internet such packages do not work over USB.
These are made for SATA (direct connection of SATA Drive to SATA Port).
My Drive is a SATA but its connected via USB.

In this case you can not send SATA Commands to the Drive,
because it is connected via USB and USB does not support that.

I tried hd-idle, hd-parm and others before and could not get any to work.
I gues that would be easy if the Router had a SATA Port but it does not have one.
Therefore I was happy that the USB-Case did the Job.

PS: I am not even sure what the USB-Case is doing.
I know it shuts the drive of (LED goes off, Power Consumption goes down 90%) yes.
But I can not tell whether the USB-Case tells the drive to go to sleep or if it just
turns off its power. I guess it will not be possible to find that out.

This is the case i use on my wrt1200 w/OpenWrt, it's obviously for a 3.5 drive, but it has a sleep function and works fine with dlna and samba, i've never had a problem with waking. It also has external power and that's the only other thing i can think of, an ssd with no external power should be fine on a usb3 port with 5 watts, but you never know, if you have a drive with external power you might test and see if anything changes.

This is the USB-Case I use


It has no external Power.

Sorry, i'm just not familiar with that case, you could also try testing with a usb to sata cable if you haven't already.

Such a Cable is the same thing as an USB-Case, it only looks different.
In Order to connect different Types of Devices like SATA and USB you always need to do the same thing. So there is a little circuit in that cable that translates SATA Commands to USB Commands and back.
So it won't be of any help for me.

In your 20 years of computer experience when have you ever encountered the situation that a particular form factor (USB to sata case) means that the electronics and drivers are the same? My experience says they are not.

I have a really nice USB Docking unit that works with Windows but not Linux. I also have some really cheap USB to sata cables that I got on eBay for about $6. They work on everything. The nice thing with the Docking station is that is also supports the older IDE drives and the unit has a beefy power supply to handle them. The cables do not but they do work great for the newer drivers that are low power and especially ssd drives.

So, I guess my question is this: Have you spent more than $6 in time on this already and would it not make sense to have a $6 backup just in case the USB case fails?

I guess you are right.

The specific USB Case also had some troubles with writing large amount of data. I really don't know why, the power saving function does not do anything here.

So I tried my other USB Case again (this one is a little different and has other firmware). So far no problems with that.

I also tried hdparm and hd-idle again with a real HDD (not ssd). I learned that the HDDs have power saving features, but the SSDs usually have not.

So now I run a long time test of my configuration just with that other type of USB Case with no Power Saving function.

Knowing that, let's talk about the UAS chips. Those chips translate from USB to SCSI/SATA. They are mostly buggy, cheap and worthless. Almost all of them are bull****. They have two modes: UAS and USB Mass Storage.
In Windows, Microsoft decided to use the USB Storage mode by default for all UAS except from drives certified for Windows to Go. That's the main thing that forbids someone installing/booting Windows on a external hard drive or a drive in a USB case.
The Linux UAS driver does the opposite. They try to use SCSI mode for all drives and maintain a large black list of chips known to be buggy. I think that your chip belongs to the blacklist.
If your case worked on Windows, you might want to try blacklisting your chip:


P.S. it would be nice to have the full kernel log.

1 Like

That sounds really difficult.
I guess you are right that the USB Case is faulty or just not 100% compatible with the openwrt. Such stuff happens all the time.

Sorry I did not keep the old log it was deleted when I rebooted the machine. Since the last error just happend while writing data it had to be some other weird problem and thats why I tried the other USB Case at that time. So far it works fine, only needs a little bit more power and never goes to sleep.

I did also write an email to kingston and they could not believe that their usb case sends the drive to sleep ... so now they are checking that...

If we put it in perspective...
It's easier to write one line in a file than physically changing a device.
Anyway, that's problem of you; but as other people will experience the problem and find this particular thread (even if you did the thing more difficult with your theories)...

It's worth the recommendation.

1 Like

A well-behaved SSD with a well-behaved SSD-to-USB controller should respond almost immediately to a wake request.

In addition to that, a well-behaved SSD-to-USB controller (a.k.a. USB-SATA bridge) includes support for UAS nowadays and allows you to submit raw SATA commands to the drive including all S.M.A.R.T. commands. Such controllers usually contains chip by ASMedia called ASM1053. See https://askubuntu.com/a/1106020/50254 for additional details.

1 Like

That might be, but it would not help because the SSDs do not support any power saving functions (at least the Kingston SSDs I have).
I did not know that before, but now I'm sure of it.

I did some additional testing with my USB cases and my SSD and a Toshiba HDD. The HDD could be controlled by hdparm, its power saving functions were working. So I could send it to sleep and wake it up again. The SSD did not react to the same commands (most likely because their are not supported by the SSD).

The same HDD in my PowerSaving USB-Case did make the same problems like the SSD. So the Case is just not 100% Compatible with the OpenWRT System.

After doing some tests with an USB Current Measurement Device I also found out that this PowerSaving USB-Case seems to simply turn off the Drive (it does not send any power saving commands to it). Thats why it can save more Power than the HDD (Idle 0,5A) in Sleep Mode (0,2A) because it completely turns it off (0,05A = just the Power the USB-Case needs). Also it works on the SSD because it just turns it off too.
Unfortunately it does not work properly so its useless.

I also wrote an E-Mail to Kingston, but that was disappointing.
They just said that their USB-Cases do not do such power saving things on their own and that it must be the system that does this. But I did some more tests with my TV, Router and PC with the 2 Types of USB-Cases I have. The PowerSaving USB-Case did the PowerSaving Thing no matter where it was connected to. The other USB Case never did it.
So I guess it has to be the case.

I am now using the other USB-Case with different Firmware and no Power Saving Function. So far this works fine. If no problems show up I just need to look for a SSD-Drive with as less idle Power Consumption as possible.

Summary:
Kingston SATA-USB Case with Firmware TB08 not useable
Kingston SATA-USB Case with Firmware V1.08 is useable

The Kingston USB Case with Firmware TB08 has Build-in Power Saving Feature which completely turns off the SATA Drive after 1 Minute of inactivity. This saves a maximum amount of Power (less than 0,05A remain) but is not 100% compatible with the openwrt.

The Kingston USB Case with Firmware V1.08 does not have this feature and seems to be 100% compatible with openwrt.

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.

Thank you very much, it worked :slight_smile:

my other Problem is about the Use of an external USB Sata Drive.
I'm not sure if you can see my other topic, its about SSD not waking up fast enough...please check.

I wanted to use an external USB SATA Case with a SSD inside.
I have 2 different USB Cases:
Kingston SATA-USB Case with Firmware V1.08 is useable
Kingston SATA-USB Case with Firmware TB08 not useable

The V1.08 is a regular USB Case as you may know it.
The TB08 is a little bit special, it has a build-in Power-Saving-Feature.
It cuts the SATA Drive from Power after 1 Minute of inactivity.
(Thats actually great because power consumption is reduced by 80%)
I had this in use with my older DIR-645 Router / DLNA-Server and never had any Problem.
But with the DIR-860L and openwrt this was not working so good. The Problem is most likely that the Drive needs a few seconds to boot (wake up). The openwrt does not wait long enough and reports an error before the drive is ready.
Usually the log entry is this:
usb 2-1: reset SuperSpeed USB device number 2 using xhci-mtk
(I don't really know what this means but its not an error)
in case the drive did not boot quick enough it can be any error like unable to read directory, data, or writing error. Again only the timestamp gave me the hint that it could be related. The error usually comes only 0.3sec after this reset usb entry.

Maybe you know more about this too?
Thank you
Nico