HDDs keep spinning after poweroff

Hey guys,
I have a setup of four HDDs mounted to a QUAD SATA head on a Raspberry Pi 4. Currently I have the problem that my HDDs keep spinning after powering down my raspbian installation. All LEDs are off (except a green LED on the SATA hat and the red power LED on the Pi).

Why is this happening and how can I prevent this behaviour.

Regards,
Frogtime

I’m sorry that this has happened. But the information you’ve provided is so limited that I can’t locate the problem.

I have currently no idea where I can start looking for more details. Therefore, I describe you what I did so far:

  • Installed the quad sata hat (v1.2) with the four HDDs mounted on the raspberry pi 4 (2GB)
  • New installation of raspbian buster lite
  • Installed the drivers by executing the script provided by the wiki: https://wiki.radxa.com/Dual_Quad_SATA_HAT
  • Updated the firmware to v8.1.3.6

All drives are visible and can be mounted as expected. The only issues is that they keep spinning when the raspberry pi 4 is powered off.

Can you tell me where I can look for further details?

Regards,
Frogtime

Thank you for describing your problem in detail. I’ll try to find a solution and let you know.

@frogtime

  1. did you modify APM of your HDD ?
  2. I’ve similar issue, after shutdown : fan of HAT still running (but no display). Only when I’m removing plug system fully stop. (I’ve connected plug :slight_smile: with my phone I can fully shutdown the powerplug and reconnect to start my RPI, my RPI is in garage).

Seeing the same issue, main difference in my setup is that I only have one hard drive, I installed OMV using the setup script they provide, and I didn’t update the firmware (because the forum post detailing the process said not to).

I also see this problem. @setq, did you find a solution?

There is some useful information on this page about the spin down, its another product that uses the same jms561 controller:
https://wiki.odroid.com/accessory/add-on_boards/xu4_cloudshell2/firmware_upgrade

The spin down time on the drives can be set using the firmware upgrade tool, the command is:
./JMS561FwUpdate -d /dev/sda -t 5

Where -t 5 would be for 5 minutes, they mention that 1 and 2 do not work.

I used this approach and my drives do spin down, not sure if this is a fix for all or not.

Hey @quadnas,

thanks for the hint. That helped for the automatic spin down.
But this didn’t solve the problem of the spinning HDDs after powering off the raspberry pi.

I found the solution to add the following systemd unit:

[Unit]
Description=Handles all initialzitations of the HDDs.
Wants=rockpi-sata.service
After=rockpi-sata.service

[Service]
Type=simple
RemainAfterExit=true
Restart=on-failure
ExecStartPre=/bin/sleep 30
ExecStart=/bin/bash /usr/bin/hdd_init.sh
ExecStop=/bin/bash /usr/bin/hdd_shutdown.sh

[Install]
WantedBy=multi-user.target

The shutdown script unmounted the partitions and called the following command:

hdparm -y /dev/sda

That did the trick for me.

I hope that helps you guys.

@frogtime Cool! Could you please explain it in detail how you did that with that systemd approach for automatic spindown at shutdown? I’m just a linux noob :see_no_evil:

I would also like to know what was in his hdd_init.sh and hdd_shutdown.sh and where does the above go? maybe in a file like quadnas.mount?

I have the same problem; after shutdown of the Pi the green light of the hat is still on and the disks are still spinning…

https://forum.radxa.com/t/hdds-keep-spinning-after-poweroff/3701/9

The method of frogtime looks useful. We can give it a try. @Joep

I think the problem is indeed the APM level of the disks @StephaneP. I wrote a systemd service file where the APM is set to 127. If the level is higher the disk won’t go to sleep.

My systemd .service file:

    [Unit]
    Description = service file for disk 1
    After = disk1.mount
    Requires = disk1.mount

    [Service]
    Type = oneshot
    ExecStartPre = /usr/sbin/hdparm -S 12 /dev/disk/by-uuid/xxxxxxxxxxxxx
    ExecStart = /usr/sbin/hdparm -B 127 /dev/disk/by-uuid/xxxxxxxxxxxxx

    [Install]
    WantedBy = multi-user.target

More information about this can be found here:

I’ll keep the link updated here because it’ll change in the near future. I will also add a shutdown script I am still working on but I think with setting the APM level, the disk will also stop on shutdown.

hdparm -B 127 /dev/sda