You are not logged in.

#1 2020-04-04 11:13:03

Cvlc
Member
Registered: 2020-03-26
Posts: 295

hdparm : Set Spindown time

Hi everyone,

I hope everyone is well. I am having problems setting my spindown time with Hdparm.

I have a laptop with both SSD and HDD, and the default arch APM setting is APM = 1 which spins down my HDD after a few seconds at idle. To avoid that I followed the advice on the above page and used this udev rule:

[root@S530]# cat /etc/udev/rules.d/69-hdparm.rules 
ACTION=="add|change", KERNEL=="sd[a-z]", ATTRS{queue/rotational}=="1", RUN+="/usr/bin/hdparm -B 150 -S 150 /dev/%k"

as well as this script to restore the setting after wakeup :

[root@S530]# cat /usr/lib/systemd/system-sleep/hdparm.sh 
#!/bin/sh
case $1 in post)
        /usr/bin/hdparm -150 -S 150 /dev/disk/by-uuid/e3e25037-f361-416d-a5da-666b7a65395b
        ;;
esac

[root@S530]# chmod a+x /usr/lib/systemd/system-sleep/hdparm.sh

These do not seem to work. After boot, the drive never goes to sleep, and after resume it goes to sleep immediately and APM is reset to 1... Some drives do not respect hdparm settings, but when I manually set hdparm -S it works, so I suppose that it has to do with my rules/script.

Does anyone see anything wrong with these rules ? I just installed Arch and have no previous experience of udev rules or systemd

Thanks for your help !

(initially posted my question here, which is an interesting read even though it wasn't the right place)

Last edited by Cvlc (2020-04-04 11:17:42)

Offline

#2 2020-04-05 09:14:55

worryag
Member
Registered: 2013-10-08
Posts: 9

Re: hdparm : Set Spindown time

Hi, it's easier for you to use TLP and it has GUI too.

Offline

#3 2020-04-05 12:35:10

Cvlc
Member
Registered: 2020-03-26
Posts: 295

Re: hdparm : Set Spindown time

Thanks very much, will try it out it seems a lot easier, and has different settings for on AC/ BAT. Will report here whether tlp's APM settings are respected.
[edit] works perfectly, thanks very much, great tip !

for reference though, can anyone point me to where I was wrong in the above steps ?

Thanks very much and have a great sunday

Last edited by Cvlc (2020-04-05 13:09:00)

Offline

#4 2020-04-05 20:03:58

worryag
Member
Registered: 2013-10-08
Posts: 9

Re: hdparm : Set Spindown time

You missed -B

/usr/bin/hdparm -150 -S 150 /dev/disk/by-uuid/e3e25037-f361-416d-a5da-666b7a65395b

Offline

#5 2020-04-05 21:25:34

Cvlc
Member
Registered: 2020-03-26
Posts: 295

Re: hdparm : Set Spindown time

Indeed ! well that explains one, so the setting after resume should work now (I think it did originally, I must have messed it up when testing different combinations)

In the end TLP doesn't really work as I thought (previous post). it sometimes works and sometimes doesn't.. and it also spins up the drive when I plug/unplug the AC cable (probably to set the new parameters).

In the end it's about the same, the B parameter (DISK_APM_LEVEL for tlp) seems to work but when combined with the S parameter it doesn't always work. I might try a combination of TLP for DISK_APM_LEVEL and hd-idle for spindown time.. but it doesn't seem like a very nice way to do it.

Offline

#6 2020-04-06 00:37:11

worryag
Member
Registered: 2013-10-08
Posts: 9

Re: hdparm : Set Spindown time

I think the best solution is TLP. At least it appeared just to replace dancing with scripts. Install tlpui and it is better to read the settings.

Offline

#7 2025-12-22 03:03:18

phoenix324
Member
Registered: 2023-08-23
Posts: 106

Re: hdparm : Set Spindown time

You have to use special value `keep` so that tlp docen't apply the values on power source change. https://linrunner.de/tlp/faq/disks.html … vice-versa

Offline

#8 2025-12-22 09:39:13

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 14,795

Re: hdparm : Set Spindown time

Moderator Note
Please look at the date of the last post before posting something new.
See https://wiki.archlinux.org/title/Genera … bumping%22

Closing this old thread


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

Board footer

Powered by FluxBB