4

I had set spindown time with a command line hdparm -S 100 /dev/sda1, but it seemed after some reboot (during which I had detached the disk, but then connected it again using the same cable/port), it did not went to sleep. So, I applied the command again.

I thought that the sleep setting is stored in the disk's firmware and handled by the disk itself, so it is independent of the computer (new OS, OS reboot, etc). Is that wrong, and the setting exists in the OS, so that I have to run the hdparm -S command again at each OS start?

Damn Vegetables
  • 1,187
  • 9
  • 19
  • Do you flash whatever disk memory after hdparm sent your setting ? Certainly not ! Therefore, how would you want these settings to automagically be active after the device being powered off ? When being powered on, your device will automatically load its default factory settings… letting to your initsystem (or yourself) the responsibility to change from defaults. – MC68020 Oct 09 '22 at 13:40
  • You can change it permanently using HDAT2: https://www.hdat2.com/ (doesn't work for all drives). – Artem S. Tashkinov Oct 09 '22 at 15:00

2 Answers2

7

It is stored in the disk itself, but in volatile memory. After a power cycle, the settings are reverted to the default.

Most drives I encountered also reset the values during initialization. This means, disconnecting and reconnecting the data connection (e.g. SATA) or rebooting (without an actual power down) the PC will also reset the values.

Hermann
  • 5,789
  • 2
  • 17
  • 32
  • 2
    For SATA devices at least, link resets can also cause the settings to be dropped on mot disks, which can be a result of a bad controller (either host side or device side), or a questionable cable. That said, some disks do actually have a way to persist such settings across resets (AIUI, this is usually done the same way that SMART configuration is persisted, by using a couple of sectors reserved for the firmware for this purpose). – Austin Hemmelgarn Oct 10 '22 at 01:24
0

As Hermann answered, the settings set by hdparm command are volatile and get reset after the drive is powered down.

Many distributions provide or document a method to make the settings permanent:

Some drives have limited support for spin down configuration, or forget it too easily even during normal use. For such drives, hd-idle can be used to implement the timer in software. It monitors drive activity and issues a spindown command after a given delay.

jpa
  • 1,269
  • 7
  • 11