USB HDD Spindown Control

Hi,
I am successfully running a Raspberry Pi4 as a file/media server using an external USB HDD for the file source for a few hours each night. However the HDD spins 24/7.

I read using hdparm sets the spindown times so I did the following -

rpi4:~ # hdparm -S 5 /dev/sda

/dev/sda:
 setting standby to 5 (25 seconds)
SG_IO: bad/missing sense data, sb]:  f0 00 01 00 50 40 05 0a 80 00 00 00 00 1d 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
rpi4:~ # 

It SEEMS to work but the spindown time is not 25 secs (that was just a test). Spindown might be around 10minutes. Also I get that ‘bad/missing sense data’ message which is odd. However, when I reboot the Pi the spindown time seems to have been lost and I have to use hdparm again.

Can the spindown time be permanently set for the HDD?

Thanks,
Chris.

Nope: https://forums.opensuse.org/showthread.php/512721-pm-utils-stops-working

Normally it should work: https://wiki.archlinux.org/title/hdparm

Thanks for your replies.

OK, hdparm settings are reset at boot. I can live with that or write a hdparm.service file or udev file to cater for that.

But ********** if I can make heads or tails of the -B and -S switch combos. The -B had a default of 128 which according to the man pages does not permit spindown - yet it does.

rpi4:~ # hdparm -B  /dev/sda

/dev/sda:
 APM_level    = 128

Makes no sense to me. But I do know the HDD spins down after a time so I leaving it at that.

Also from what else I can glean the hdparm “SG_IO: bad/missing sense data” messages are possibly related to the fact that the HDD is connected via USB.

Too messy, too confusing.

Regards…

PS. My use of the word D+A+M+N gets censored with asterisks ?

Power management of HDDs is a mess. You may try https://software.opensuse.org/package/hd-idle?search_term=hd-idle

Description says: “hd-idle is a utility program for spinning-down external disks after a period of idle time. Since most external IDE disk enclosures don’t support setting the IDE idle timer, a program like hd-idle is required to spin down idle disks automatically.” However it works for all disks.