[Debian Stretch] Creating udev rule for hdparm spin-down command?

Post Reply
User avatar
Gburas
Posts: 80
Joined: Sat Sep 19, 2015 7:13 am
languages_spoken: English, Polish
ODROIDs: Xu4
Location: Poland, Sopot
Contact:

[Debian Stretch] Creating udev rule for hdparm spin-down command?

Unread post by Gburas » Fri Dec 28, 2018 8:41 pm

Hi
I`m using Debian Stretch by Meveric and i`m trying to create udev rule to change Advance power management level and Spindown timeout. First I have created rule with

Code: Select all

sudo nano /etc/udev/rules.d/69-hdparm.rules 
wchich identifies my drive by ID_SERIAL_SHORT:

Code: Select all

ACTION=="add", KERNEL=="sd[a-z]", ENV{ID_SERIAL_SHORT}=="W9324DFH", RUN+="/usr/bin/hdparm -B 127 -S 240 /dev/%k"
It didn`t work so I have changed to:

Code: Select all

ACTION=="add", SUBSYSTEM=="block", KERNEL=="sda", RUN+="/usr/bin/hdparm -B 127 -S 240 /dev/sda"
But it still doesn`t work. Next I did:

Code: Select all

udevadm control –reload
udevadm control –reload-rules
But still nothing. What i`m doing wrong?

User avatar
mad_ady
Posts: 5428
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1, H2, N2
Location: Bucharest, Romania
Contact:

Re: [Debian Stretch] Creating udev rule for hdparm spin-down command?

Unread post by mad_ady » Fri Dec 28, 2018 10:41 pm

Here are mine, which work:

Code: Select all

adrianp@aldebaran:~$ cat /etc/udev/rules.d/90-disk.rules
ACTION=="add", ENV{DEVNAME}=="/dev/sd?", SUBSYSTEM=="block", ENV{ID_SERIAL_SHORT}=="NA4TEVC6", RUN+="/sbin/hdparm -S 60 $env{DEVNAME}"
ACTION=="add", ENV{DEVNAME}=="/dev/sd?", SUBSYSTEM=="block", ATTR{size}=="5860533168", RUN+="/usr/local/sbin/hd-idle -a $env{DEVNAME} -i 630 -l /var/log/hd-idle.log"

User avatar
Gburas
Posts: 80
Joined: Sat Sep 19, 2015 7:13 am
languages_spoken: English, Polish
ODROIDs: Xu4
Location: Poland, Sopot
Contact:

Re: [Debian Stretch] Creating udev rule for hdparm spin-down command?

Unread post by Gburas » Mon Dec 31, 2018 9:48 pm

mad_ady wrote:
Fri Dec 28, 2018 10:41 pm
Here are mine, which work:

Code: Select all

adrianp@aldebaran:~$ cat /etc/udev/rules.d/90-disk.rules
ACTION=="add", ENV{DEVNAME}=="/dev/sd?", SUBSYSTEM=="block", ENV{ID_SERIAL_SHORT}=="NA4TEVC6", RUN+="/sbin/hdparm -S 60 $env{DEVNAME}"
ACTION=="add", ENV{DEVNAME}=="/dev/sd?", SUBSYSTEM=="block", ATTR{size}=="5860533168", RUN+="/usr/local/sbin/hd-idle -a $env{DEVNAME} -i 630 -l /var/log/hd-idle.log"
thanks but unfortunately it still does not work with me, I copied your command but it still do not want to act
generally it does not execute commands at all because I check with the command hdparm -B 120 and this parameter is not changed after boot, I can manually change it
can i somewhere find in a log why does not execute the command?

User avatar
mad_ady
Posts: 5428
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1, H2, N2
Location: Bucharest, Romania
Contact:

Re: [Debian Stretch] Creating udev rule for hdparm spin-down command?

Unread post by mad_ady » Mon Dec 31, 2018 11:44 pm

You can run udev in debug mode to find out, but I don't remember the exact command.

User avatar
meveric
Posts: 9771
Joined: Mon Feb 25, 2013 2:41 pm
languages_spoken: german, english
ODROIDs: X2, U2, U3, XU-Lite, XU3, XU3-Lite, C1, XU4, C2, C1+, XU4Q, HC1, N1, Go
Contact:

Re: [Debian Stretch] Creating udev rule for hdparm spin-down command?

Unread post by meveric » Mon Dec 31, 2018 11:50 pm

also remember that hd-idle is a different tool that does not come pre-installed, so this line won't work at all for you.
Donate to support my work on the ODROID GameStation Turbo Image for U2/U3 XU3/XU4 X2 X C1 as well as many other releases.
Check out the Games and Emulators section to find some of my work or check the files in my repository to find the software i build for ODROIDs.
If you want to add my repository to your image read my HOWTO integrate my repo into your image.

User avatar
Gburas
Posts: 80
Joined: Sat Sep 19, 2015 7:13 am
languages_spoken: English, Polish
ODROIDs: Xu4
Location: Poland, Sopot
Contact:

Re: [Debian Stretch] Creating udev rule for hdparm spin-down command?

Unread post by Gburas » Thu Jan 03, 2019 10:21 pm

I could not figure out why udev.rule did not work. (I do not use the hd-idle program, only the hdparm itself).
finally, I solved the problem by modifying the /etc/hdparm.conf file at the end:

Code: Select all

/ dev / disk / by-id / ata-ST1000LM035-1RK172_W9324DFH {
apm = 120
spindown_time = 240
}
the change is effective and permament at reboot, I do not know how it be after the update of hdparm, and this method works probably on debian base systems
thank you for your help

Post Reply

Return to “Other OS”

Who is online

Users browsing this forum: No registered users and 0 guests