I have a scheduled job that automatically shuts down my Rock64 running OMV 5 at a specific time at night. Sadly my Rock64 doesn't support automatic startup so the only way to power it on is manually either using the physical power button or removing complete power (also pulling out the power barrel connector) and restoring the power. To get around this I use smart plugs to wake it up again.
Now, powering on and off the equipment with the smart plugs isn't a problem except that when OMV shutdowns it's not safely powering off the HDDs too. This means when my smart plugs eventually power off the powered, USB 3 hub a couple of minutes later with the HDDs connected to it, it is forcefully cutting the power to fully spinning HDDs.
I can rule out the hub not being the problem because safely ejecting the device in Windows gracefully spins down the HDDs.
The automatic shutdown feature found at `System > Power Management` is very basic. Obviously first of all it's not spinning down the HDDs properly and secondly when a data transfer on SMB for example is in progress the automatic shutdown proceeds anyway without checking for system activity.
I thought about using an additional Cron job to unmount and sleep the drives using `sudo hdparm -y /dev/sda1` but that caused issues when rebooting just the Rock64 alone. The HDDs seemed to be stuck in an infinite sleep and the Rock64 was unreachable until I completely power cycled the HDDs off and back on.
The interesting thing is if I connect the external HDDs directly to the Rock64 eliminating the USB 3 hub, when I shutdown the Rock64 the HDDs do in fact power off but they don't do it gracefully and it's as though I'm just ripping the power out while they are running at full RPM, very much like what the smart plug does. Conversely, I would expect the shutdown stage to spin the HDD down then power off. All of this sudden powering off to the HDDs won't do the HDD heads any good.
Any ideas how to get this working please?