Shutdown spins up idled hard drives

I have 3 external USB HD’s on my N2+ (One day I really must build a NAS), 1 takes most of the daily use while the other 2 are storage for media I want to keep but don’t watch daily. I have enabled the HDD Parking in CoreELEC settings but on shutdown the parked drive are spinning back up only to shutdown. I notice @vpeter posted a script to unmount the drives prior to shutdown last year but with the move to Matrix I wondered if there was now a better way of getting CE to respect the idle settings. i.e. if drive is parked then leave it the hell alone?

What do you set for those 3 possible settings?
Don’t remember now exactly (and cannot check at the moment) but I set 3 seconds (for waiting?), and leave the last option disabled. This way when shutting down my N2, while drives are already “sleeping”, they don’t spin before shutdown.

Parking = On, Parking time 60 Seconds, Idle Time 15 minutes. I did some tests earlier it would appear that the system is spinning up the idled disks to park them on Shutdown.

Took a look in the GitHub to find out what code is being used, its hdparm for the parking and hd-idle for the idle settings, however I have hit my limits as while my Linux is pretty decent, my Python is none existant.

I have my drives set with manufacturer’s disk utility (WD Drive Utilities) to spin down after 10 min, so I don’t use this setting in CE.
My settings: Parking = ON, Parking Time = 3 sek, and Idle Time = Disabled (since my drives are set to go to sleep after 10min).
When I shut down my N2 the drives don’t spin up, they just go to power off without any prior action; if drives are active at that moment they just quietly park&turn off.

1 Like

@Sholander Thanks, you mentioning WD Drive Utilities made me check something and I’m glad I did. While the standby timers were set against the drive the standby_z variable wasn’t enabled. Not sure of the cause but I think it dates back to when I swapped the drives from NTFS to EXT4 format.

For anyone that wants the code its

Install sdparm from Entware opkg install sdparm
Query the disks ability and value for standby (sda used in this example) sdparm --flexible -6 -p po -l /dev/sda
Enable standby_z sdparm --flexible -6 -v -S -p po --set=STANDBY_Z=1 /dev/sda
Set the SCT (Standby_z condition timer in units of 100ms so 9000=15 minutes) sdparm --flexible -6 -v -S -p po --set=SZCT=9000 /dev/sda

I would expect this sort of behaviour since the OS needs to SYNC all drives before it releases them at shutdown. This often accounts for the very long shutdown process on LINUX machines.


1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.

About | FAQ | Terms of Service | Privacy Policy | Legal Notice