I recently replaced the HDD in my Toshiba laptop because I could hear increasingly strange noises from the old one.
My new replacement was a Western Digital SATA drive - not an SSD but rather one of the mechanical ones. (Cost only $12 for 500GB so I figured I would give it a try)
After fitting the new HDD I found that some actions appeared very slow. For example using Rox to open any of the files on HDD resulted in a noticeable delay before the window contents displayed properly. It appeared that the WD drive was going to sleep after only about 8 seconds.
I had a look at hdparm and specifically the -S (Spindown time) parameter (that's capital "S") and tried various options - initially without success.
However - it turns out that the -S parameter is only meaningful when "advanced power management" (APM) is activated. (At least this is the case with some types of drives).
So it was also necessary to modify the APM value by setting the -B option to a value of 254.
This gave me a useful command as follows:
hdparm -B 254 -S 240 /dev/sda
(-B value sets advanced power management to a value that enables the spindown timeout parameter to function)
(-S value sets spindown timeout to 20 minutes. To understand this setting, or to calculate longer timeout you must read the notes below)
I have now made this command into a script that I manually click after booting. (Because the drive resets to it's default values after powering down the laptop)
****************************************************************
NOTES:
With regard to the -S (spindown time) parameter hdparm calculates the spindown values as follows:
https://askubuntu.com/a/39764
A value of zero means "timeouts are disabled": ie the device will not automatically enter standby mode.
Values from 1 to 240 specify multiples of 5 seconds, yielding timeouts from 5 seconds to 20 minutes.
Values from 241 to 251 specify from 1 to 11 units of 30 minutes, yielding timeouts from 30 minutes to 5.5 hours. A value of 252 signifies a timeout of 21 minutes.
A value of 253 sets a vendor-defined timeout period between 8 and 12 hours, and the value 254 is reserved. 255 is interpreted as 21 minutes plus 15 seconds. Note that some older drives may have very different interpretations of these values.
.
With regard to the -B (APM) parameter - the advanced power management settings are not just " linear digital" values - certain numbers have special meanings:
https://unix.stackexchange.com/question ... 582#174582
hdparm cannot do any calculations with regard to the -B value (APM) and it depends on drive manufacturer
Here is more detail about APM:
https://superuser.com/questions/555400/ ... 622#558622
.
Other helpful commands
You can see a list of all your connected storage devices and their corresponding device paths with the following command:
#fdisk -l
(that's a lowercase "ell")
Interrogate STATUS of a particular drive:
#hdparm -C /dev/sda
(eg active/idle/standby)
Interrogate PARAMETERS of a particular drive:
#hdparm -I /dev/sda
(That's an uppercase "eye")
Also check hdparm -i /dev/sda)
(That's a lowercase "eye")
.