You are not logged in.

#1 2012-08-31 13:56:20

jimduchek
Member
Registered: 2008-01-06
Posts: 8

systemd + hard drive powersaving

Is there anyway (kernel command line, hdparm argument) to force the hard drive on my laptop to NEVER go into powersaving mode, even after reboot?  In whatever default mode it's in, it's just horribly slow ('ls' takes 3-4 seconds to run, no matter the situation.  X/XFCE takes almost 2 (!) minutes to start if I forget to kill the powersaving first.)  'hdparm -B 255 /dev/sda' fixes the matter.  But getting to a terminal takes forever w/the powersaving on and it's annoying as hell.  Systemd, unfortunately, provides no /etc/rc.local functionality, but even so, I'd rather kill the powersaving far earlier in the boot than that anyway.  -k/K options to hdparm don't work (inappropriate ioctl), to save settings between boots...  Any ideas?

Offline

#2 2012-08-31 14:04:21

progandy
Member
Registered: 2012-05-17
Posts: 2,146

Re: systemd + hard drive powersaving

Create your own service file that runs with local-fs-pre.target or local-fs.target?
Edit: See man bootup to find a suitable point in the bootup tree

Last edited by progandy (2012-08-31 14:05:25)

Offline

#3 2012-10-01 08:14:54

Preycon
Member
From: México, D.F.
Registered: 2009-02-14
Posts: 29

Re: systemd + hard drive powersaving

I'm also interested in this!

Offline

#4 2012-10-01 12:52:12

R00KIE
Forum Moderator
From: Between a computer and a chair
Registered: 2008-09-14
Posts: 3,117

Re: systemd + hard drive powersaving

Maybe this is what you're after https://aur.archlinux.org/packages.php?ID=63119


R00KIE
Tm90aGluZyB0byBzZWUgaGVyZSwgbW92ZSBhbG9uZy4K

Offline

#5 2012-10-01 14:59:26

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,412

Re: systemd + hard drive powersaving

I made a udev rule for my Momentus XT.  When the make and model of my Momentus XT is detected, I have udev run a quick "# hdparm -B 240 /dev/disk/by-id/XXXXX" (I picked 240 randomly because it is high, but not quite max...)

But these rules are not persistent between suspends/hibernates.  So I use /lib/systemd/system-sleep to run a script to reinstate the settings I had earlier.  I could have determined the previous level, stored it and reinstated that specific level.  But I was lazy and figured I would just stick with 240 all the time.  So my script basically tests to see if /dev/disk/by-id/XXXX exists, and if it does, it simply runs the same hdparm command as udev on wake.

See here:
http://www.reactivated.net/writing_udev_rules.html
http://www.freedesktop.org/software/sys … rvice.html

Offline

#6 2012-10-02 11:17:02

markoer
Member
Registered: 2010-12-15
Posts: 55

Re: systemd + hard drive powersaving

don't create systemd service. proper way would be to use udev rules in /etc/udev/rules.d, here is example for your sata or scsi drive

ACTION=="add", KERNEL=="sda", RUN+="/sbin/hdparm -B 254 /dev/sda"

Offline

#7 2012-10-05 06:20:06

Preycon
Member
From: México, D.F.
Registered: 2009-02-14
Posts: 29

Re: systemd + hard drive powersaving

Thanks to all now it works!

I've created the file 10-local.rules with the suggested code and everything works as expected smile!!

Last edited by Preycon (2012-10-05 06:20:29)

Offline

Board footer

Powered by FluxBB