Idle Spindown doesn't work with an external HDD

Hi!

I have a NanoPI R5S with a Seagate Backup Plus external USB HDD.

The drive is only used occasionally for its capacity so I’d prefer for it to stay down most of the time. It’s the only audible thing on my entire desktop :wink:

I’m trying to set idle spindown:

root@NanoPi:~# hdparm -S 60 /dev/sda
/dev/sda:
 setting standby to 60 (5 minutes)
SG_IO: bad/missing sense data, sb[]:  70 00 05 00 00 00 00 0a 00 00 00 00 24 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

The magic numbers response can be decoded using a CLI tool:

root@NanoPi:~# sg_decode_sense 70 00 05 00 00 00 00 0a 00 00 00 00 24 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Fixed format, current; Sense key: Illegal Request
Additional sense: Invalid field in cdb

So it says it’s not supported. However, I used the same HDD drive with macOS and the idle spindown worked without any issues whatsoever.

Is there anything more that can be tried? Thanks in advance for any help!

Not the drive…the USB adapter

I have a 1TB laptop drive on a cheapo USB->SATA adapter…for some reason the hdparm stuff just doesn’t make it thru

More often than not it takes a little bit more $$$ to get a quality adapter

Also…after poking around…might need sdparm rather than hdparm

Tried sdparm but it doesn’t even list the relevant parameters:

root@NanoPi:~# sdparm -l -a /dev/sda
    /dev/sda: Seagate   BUP Slim SL       0304
    Direct access device specific parameters: WP=0  DPOFUA=0
Flexible disk (SBC) [fd] mode page:
  XRATE         0  [cha: n, def:  0, sav:  0]  Transfer rate
  NUM_HD        16  [cha: y, def: 16, sav: 16]  Number of heads
  SECT_TR       63  [cha: y, def: 63, sav: 63]  Sectors per track
  BYTE_SECT     512  [cha: y, def:512, sav:512]  Bytes per sector
  NUM_CYL       16383  [cha: y, def:16383, sav:16383]  Number of cylinders

I’m using the disk over a USB A ↔ USB Micro B cable (like this one: https://www.amazon.pl/Cable-Matters-twardego-zewnętrznych-Expansion/dp/B00C7T78H0).
Are you saying it’s the NanoPI R5S built-in USB controller that’s not able to handle those sdparm requests?

I was able to spindown the disk using sdparm --readonly --command=stop /dev/sda and spin it back up with sdparm --command=start /dev/sda so it can theoretically work with software. The problem is there’s neither SCT nor STANDBY parameters available in sdparm, so those don’t work:

sudo sdparm -l --get SCT /dev/sdX
sudo sdparm -l --get STANDBY /dev/sdX

I think it’s a lack of communication for the hdparm parameters from USB to IDE is why it can’t read/write the parameters…

What device changes the SATA->USB (the enclosure or plug) that is the weak link…not the cable

There is ALOT of issues with those adapter/drive combos (it seems to be a common problem)
https://forums.linuxmint.com/viewtopic.php?t=260618

In the last link…it shows this (not sure it will help)

`sudo sdparm -l --save --set SCT=6000 /dev/sd?`

I’ve never really screwed around much with spindown/sleep time however
wish I could help more

sudo sdparm -l --save --set SCT=6000 /dev/sd?

Doesn’t work. The SCT parameter is unknown.

Thanks nonetheless for your input!

Interesting to look at the USB adapter. Makes sense actually. Do these options work?

hdparm -y /dev/sda # enter standby mode
hdparm -Y /dev/sda # enter sleep mode

It is btw not about the USB controller of the R5S, but the USB-SATA adapter of the external drive/case/docking station. But of course also the controller/driver/kernel might be a reason. We’ll switch to mainline kernel with the R5S soon, so then worth to retest.

Nope:

root@NanoPi:~# hdparm -y /dev/sda
/dev/sda:
 issuing standby command
SG_IO: bad/missing sense data, sb[]:  70 00 05 00 00 00 00 0a 00 00 00 00 24 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
root@NanoPi:~# hdparm -Y /dev/sda

/dev/sda:
 issuing sleep command
SG_IO: bad/missing sense data, sb[]:  70 00 05 00 00 00 00 0a 00 00 00 00 24 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
root@NanoPi:~# sg_decode_sense 70 00 05 00 00 00 00 0a 00 00 00 00 24 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Fixed format, current; Sense key: Illegal Request
Additional sense: Invalid field in cdb

It is btw not about the USB controller of the R5S, but the USB-SATA adapter of the external drive/case/docking station. But of course also the controller/driver/kernel might be a reason. We’ll switch to mainline kernel with the R5S soon, so then worth to retest.

Oh, interesting, is that going to be a new DIetPi release?

Okay seems to be all hdparm power state instructions which fail.

Most likely we will make available new R5S images between the DietPi releases, since the DietPi code on the systems does not need to change, only the build tools.

1 Like