You are not logged in.
I need to run
# hdparm -B 255 /dev/sda
at startup. I used to do this in /etc/rc.local using initscrips. How do I do this using systemd?
Offline
CPU-optimized Linux-ck packages @ Repo-ck • AUR packages • Zsh and other configs
Offline
This is what I did to replace /etc/rc.local{,.shutdown} with what I wanted run at startup{,.shutdown}.
Hope it helps.
Offline
Spend myself hours on solving this... without luck!
One way which does also NOT work:
Create a file i.e.
hdparm.sh
in /etc/profile.d/
put the hdparm commando in the file
echo 'hdparm -B254 /dev/sdX' > /etc/profile.d/hdparm.sh
make it executable (755)
restart and check hdparm -B /dev/sdX
BTW: Default was OFF (255) which did not stop SAMSUNG HM641JI from parking heads every 8 sec.
-B254 stopps klicking entirely for this drive.
Isn't there a suitable simple (kiSs?) solution? I've tried to put this in neraly every .profile *rc and everywhere -
And according to the following post:
I'm far away from understanding such hacks. Though I was in the Newbie-Corner....
Last edited by renegat (2012-12-29 11:50:25)
Offline
How about something like this. Use udev to determine if a given disk is rotational or not, and then run that hdparm command on the rotational ones.
So make a file /etc/udev/rules.d/75-hdparm.rules that includes:
ACTION=="add", KERNEL=="sd[a-z]", ATTR{queue/rotational}=="1", RUN+="/sbin/hdparm -B 254 /dev/$kernel"
I figure that this way you are not unecessarily changing the setting on SSDs.
Offline
Made it! The WonderWoofy's answer was the solution:
I still got no idea, how it works, but it works!
Thank you alot - think I've got somthing to read about 'udev'...
Last edited by renegat (2012-12-29 12:33:41)
Offline
Another, less general, solution. Create a /usr/local/sbin/rc.local script with the following content:
#!/bin/bash
#
# /usr/local/sbin/rc.local: Local multi-user startup script.
hdparm -B254 /dev/sda
You can add whatever you want to be run at boot with root privileges.
Make it executable:
chmod +x /usr/local/sbin/rc.local
Create a service file for rc.local in /etc/systemd/system/rc-local.service with the following content:
[Unit]
Description=/etc/rc.local Compatibility
ConditionFileIsExecutable=/usr/local/sbin/rc.local
[Service]
Type=oneshot
ExecStart=/usr/local/sbin/rc.local
TimeoutSec=0
StandardOutput=tty
RemainAfterExit=yes
SysVStartPriority=99
[Install]
WantedBy=multi-user.target
Enable it:
#systemctl enable rc-local
Reboot.
Last edited by patroclo7 (2012-12-29 12:41:25)
Mortuus in anima, curam gero cutis
Offline
Looks interesting too, thank you!
I've tried likewise way by creating
/etc/systemd/system/hdplccs.service :
[Unit]
Description=hdparm_load_cycle_count_save
[Service]
Type=oneshot
ExecStart=/sbin/hdparm -B254 /dev/sda
TimeoutSec=0
StandardInput=tty
RemainAfterExit=yes
[Install]
WantedBy=multi-user.target
made it executable and tried to start
systemctl start hdplccs.service
which did also not work.
Will try your way next installation.
Thank you all and have a Happy New Year
renegat
Offline
I do not know what is actually wrong with your service file, but for sure there is no need to make it executable. Alas or luckily according to the points of view, it is not a script (but can be used to run a script)...
Mortuus in anima, curam gero cutis
Offline
Hi@ All!
I've tried to get power management work on my RTL8187SE Wireless LAN Controller.
# iwconfig wlan0 power on
works fine [edit] for some seconds, then connection is lost!
RTL8187SE is known for such issues due to 'too' aggressive HW-PM - i have been warned ;-)
[/edit]
but ...same procedure as last time... how to get it set automatic at boot?
Tried creating : /etc/udev/rules.d/wlan0_power_save.rules
with
ACTION=="add", SUBSYSTEM=="net", KERNEL=="wlan0", RUN+="/usr/sbin/iwconfig wlan0 power on"
which does not work cause 'iwconfig wlan0' seems to be executed while 'power on' produces an error.
The way given here depends on 'iw' - but 'iw' does not work due to missing 'nl80211'... *confused*
Any ideas?
renegat
Edit:
'iw' is the 'newer' set of wireless-tools - and does not support such old cards as mine.
Last edited by renegat (2013-02-16 09:43:35)
Offline
renegat, I am glad to ahve helped with the hdparm issue. But this last post is a totally different issue. You should probably start a new thread, else your question is likely to just get lost in the mix.
I am also glad to see that you have apparently actually gone out and read some information regarding the answer I gave above. It is nice to see a newcomer actually have the desire to learn rather than expect spoon feeding. Unfortunatley we have been seeing way too much of that lately. Your attitude is a breath of fresh air. Start a new thread and I am sure you will get some help.
Offline