HDDs not powered off after shutdown

Hi all,

I’m wondering if / why the rockpi-sata.service doesn’t support powering off the HDDs after shutdown of the RPi.

I’m running an RPi4B with the lates RPi OS (headless) and OpenMediaVault 6.0.15. I successfully installed the rockpi-sata.service and it is working properly - except of the issue that the HDDs keep spinning even after I sudo shutdown -h now the RPi.
I tried the service from HDDs keep spinning after poweroff but it doesn’t work. I tried different combinations of unit configurations but there are only two results:

  1. Manually stopping the service indeed stops the HDDs
  2. Shutdown the RPi stops the HDDs for a few milliseconds and turns them on again

My current version is this:

/etc/systemd/system/poweroff_hdds.service:

[Unit]
Description=Power off Raid HDDs when shutdown the system.
RequiresMountsFor=/

[Service]
Type=oneshot
RemainAfterExit=true
ExecStart=true
ExecStop=/bin/bash /usr/local/bin/service.raid/poweroff_hdds.sh

[Install]
WantedBy=multi-user.target

I also tried

[Unit]
Description=Power off Raid HDDs when shutdown the system.

[Service]
Type=oneshot
RemainAfterExit=no
ExecStart=/bin/bash /usr/local/bin/service.raid/poweroff_hdds.sh

[Install]
WantedBy=poweroff.target

and many more, but it’s just not working.

Of course I enabled the service:

pi@rpinvr:/etc/systemd/system/multi-user.target.wants $ ls -al | grep poweroff_hdds.service

lrwxrwxrwx  1 root root   41 Apr 25 22:25 poweroff_hdds.service -> /etc/systemd/system/poweroff_hdds.service

This is my script:

/usr/local/bin/service.raid/poweroff_hdds.sh

#!/bin/bash

echo "Power off /dev/sdb"
hdparm -y /dev/sdb
sleep 1

echo "Power off /dev/sdc"
sleep 1
hdparm -y /dev/sdc

So actually I have three questions:

  1. Why aren’t the HDDs been powered off automatically (by the rockpi-sata.service) when the RPi is shutdown?
  2. How can I can I make it work to poweroff the HDDs when shutdown the RPi - the service is obviously stopped properly (see picture below)?
  3. Is there a way to show the echo lines from above in the shutdown list (see picture below)?

1 Like

I do have the same problem, is there any news on this?