HDD tweak

Issues Related to Hardware (Sound, Video, Printers, Scanners, Webcams, Touchpads, Keyboards, Sensors, Drives, GRUB, etc.)

Moderator: Moderators

HDD tweak

Postby nomko » Tue Dec 31, 2013 0:02

Hi everybody


I want to try out this tweak foiund on this wiki:
Tune Hard Drive Performance

The hard drive is the slowest compenent of your computer. A little tuning goes a long way for performance.
vim /etc/conf.d/hdparm
Add the following at the bottom
hda_args="-a16 -c1 -k1 -u1 -S0"
cdrom0_args="-c1 -k1 -u1"
Start hdparm during boot
rc-update add hdparm boot


But the last command
Code: Select all
rc-update add hdparm boot

does not work. I get an error message in the temrinal saying this:
nomko@nomko-sabayon141 ~ $ rc-update add hdparm boot
bash: rc-update: opdracht niet gevonden

It's Dutch and the last line translated means:
bash: rc-update: command not found

What should i do?
Thanks!
ASUS P5KPL-AM SE*Intel Core2 Quad CPU Q8200*4 GiB ram*nVidia GeForce 9500GT*Realtek RTL8101/8102E*Optiarc DVD-RW AD-7200A*HDD:Samsung HD501LJ/HD103SI*Sitecom X5-N600 Router
nomko
Young Hen
 
Posts: 37
Joined: Fri Dec 27, 2013 21:57
Location: The Netherlands

Re: HDD tweak

Postby nomko » Wed Jan 01, 2014 15:28

Just had a ,look in the wiki's and i see two "commands":

systemd
rc-update

If i change rc-update into systemd, will this command work:

Code: Select all
systemd add hdparm boot




Any help would be very much appreciated since i'm a first time Sabayon user here.
ASUS P5KPL-AM SE*Intel Core2 Quad CPU Q8200*4 GiB ram*nVidia GeForce 9500GT*Realtek RTL8101/8102E*Optiarc DVD-RW AD-7200A*HDD:Samsung HD501LJ/HD103SI*Sitecom X5-N600 Router
nomko
Young Hen
 
Posts: 37
Joined: Fri Dec 27, 2013 21:57
Location: The Netherlands

Re: HDD tweak

Postby imaginasys » Wed Jan 01, 2014 17:41

rc-update is for the old init sytem from system V, you seems to be using systemd.

In systemd, you must first enable the service (to make it start at boot) and then start it.
Here is the 2 commands you should be using instead of rc-update :

systemctl enable hdparm
systemctl start hdparm

for more details see man pages of systemctl.

for a graphic ui install "sys-apps/systemd-ui" and run it with "kdesudo systemadm&" (or gtk equivalent if you're on gnome).

I recommand you to read about systemd :
http://wiki.gentoo.org/wiki/Systemd
http://www.freedesktop.org/wiki/Software/systemd/

Good luck!

Bernard
imaginasys
Simple Hen
 
Posts: 51
Joined: Sat Nov 23, 2013 6:59

Re: HDD tweak

Postby nomko » Wed Jan 01, 2014 18:02

imaginasys wrote:rc-update is for the old init sytem from system V, you seems to be using systemd.

In systemd, you must first enable the service (to make it start at boot) and then start it.
Here is the 2 commands you should be using instead of rc-update :

systemctl enable hdparm
systemctl start hdparm

This is what i get when using the first command:
nomko@nomko-sabayon141 ~ $ systemctl enable hdparm
Failed to issue method call: Access denied

What does this mean?


imaginasys wrote:for more details see man pages of systemctl.

for a graphic ui install "sys-apps/systemd-ui" and run it with "kdesudo systemadm&" (or gtk equivalent if you're on gnome).

I recommand you to read about systemd :
http://wiki.gentoo.org/wiki/Systemd
http://www.freedesktop.org/wiki/Software/systemd/

I will read those wiki's! It's not that i don't want to learn, but Sabayon is very new to me and i have to forget most commands i used under Mint i find out now.
Thanks again!
ASUS P5KPL-AM SE*Intel Core2 Quad CPU Q8200*4 GiB ram*nVidia GeForce 9500GT*Realtek RTL8101/8102E*Optiarc DVD-RW AD-7200A*HDD:Samsung HD501LJ/HD103SI*Sitecom X5-N600 Router
nomko
Young Hen
 
Posts: 37
Joined: Fri Dec 27, 2013 21:57
Location: The Netherlands

Re: HDD tweak

Postby Fitzcarraldo » Wed Jan 01, 2014 19:00

nomko wrote:This is what i get when using the first command:
nomko@nomko-sabayon141 ~ $ systemctl enable hdparm
Failed to issue method call: Access denied

What does this mean?

It means you have to be root user to do stuff like that!

Code: Select all
$ su
Password:  <--- Enter the root user's password here.
#

Notice the root user's prompt is a hash sign rather than a dollar sign.
User avatar
Fitzcarraldo
Sagely Hen
 
Posts: 7977
Joined: Sat Mar 10, 2007 5:40
Location: United Kingdom

Re: HDD tweak

Postby nomko » Wed Jan 01, 2014 19:10

ok, i'll give it a shot now!


And now i get this:
nomko-sabayon141 nomko # systemctl enable hdparm
Failed to issue method call: No such file or directory
nomko-sabayon141 nomko #

What goes wrong here? Thanks again!
ASUS P5KPL-AM SE*Intel Core2 Quad CPU Q8200*4 GiB ram*nVidia GeForce 9500GT*Realtek RTL8101/8102E*Optiarc DVD-RW AD-7200A*HDD:Samsung HD501LJ/HD103SI*Sitecom X5-N600 Router
nomko
Young Hen
 
Posts: 37
Joined: Fri Dec 27, 2013 21:57
Location: The Netherlands

Re: HDD tweak

Postby imaginasys » Wed Jan 01, 2014 22:10

It's because you don't have any systemd service for hdparm.

To see all service (as root) try : # systemctl -t service -a

If you don't see hdparm anywhere then it doesn't exist.
In fact hdparm service is created but for the old init system V.
There is a script file : /etc/init.d/hdparm
Installed by hdparm:

Code: Select all
perfmonk@zeus /etc $ equo query files sys-apps/hdparm
╠  @@ Files Search
╠  ### /etc
╠  ### /etc/conf.d
╠  ### /etc/conf.d/hdparm
╠  ### /etc/init.d
╠  ### /etc/init.d/hdparm
╠  ### /sbin
╠  ### /sbin/hdparm
╠  ### /sbin/idectl
<...snip...>


So the problem seems to be caused by hdparm wich is not adapted for systemd.

On the following post : http://lists.freedesktop.org/archives/systemd-devel/2012-June/005600.html
Mr. Leonardt Poettering suggest that we should use a udev rule for setting hdparms. This is viewed as the "systemd" way of doing thoses things since it would not be distro specific.

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:

Code: Select all
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.

Change the hdparm parameters to whatever you need (but be very carefull... wrong settings can destroy your disk).

For different settings when running on AC / battery, You could do it via a simple udev rule also :

/etc/udev/rules.d/98-apmsettings.rules:

Code: Select all
SUBSYSTEM=="power_supply", ENV{POWER_SUPPLY_ONLINE}=="0", RUN+="/usr/bin/hdparm -B 128 /dev/sda"
SUBSYSTEM=="power_supply", ENV{POWER_SUPPLY_ONLINE}=="1", RUN+="/usr/bin/hdparm -B 254 /dev/sda"

This would set apm to 254 when the laptop is plugged in and respectively 128 when unplugged. Also, it should always work, even after resuming from suspend.

In my point of view these udev rules should be added when you install hdparm. So you don't even need to find out a way to use it at boot...

I hope it helps!

Regards,
Bernard
imaginasys
Simple Hen
 
Posts: 51
Joined: Sat Nov 23, 2013 6:59

Re: HDD tweak

Postby sabayonino » Thu Jan 02, 2014 23:59

you're running all comands as user .... ($)

use "sudo" or log as root (#)

[edit] oppss ... i missed Fitz post viewtopic.php?f=56&t=31229&p=168502#p168455 :mrgreen:
User avatar
sabayonino
Sagely Hen
 
Posts: 2463
Joined: Sun Sep 21, 2008 1:12
Location: Italy

Re: HDD tweak

Postby batvink » Sat Jan 04, 2014 13:54

You could use Cron for that, or in our case: systemd-timers.
But that would be a workaround, not a solution.

udev rules are run when power is connected/disconnected but not after suspending/resuming.
You can create a systemd unit that will run both after boot and after resuming from suspend.

As root:
Code: Select all
nano -w /etc/systemd/system/hdparm.service

with following content:
Code: Select all
[Unit]
Description=HD params
After=suspend.target
After=hibernate.target
 
[Service]
Type=oneshot
ExecStart=/sbin/hdparm -a16 -c1 -k1 -u1 -S0 /dev/sda
ExecStart=/sbin/hdparm -c1 -k1 -u1 /dev/sr0

[Install]
WantedBy=suspend.target basic.target
WantedBy=hibernate.target

Then, enable and start the service:
Code: Select all
systemctl enable hdparm.service

Code: Select all
systemctl daemon-reload



Or, even more simple., you could create a script called: hdparm_set in:
/usr/lib/systemd/system-sleep/
with following content:
Code: Select all
#!/bin/sh
hdparm -a16 -c1 -k1 -u1 -S0 /dev/sda
hdparm -c1 -k1 -u1 /dev/sr0

save the script, and make it executable:
chmod +x /usr/lib/systemd/system-sleep/hdparm_set
User avatar
batvink
Old Dear Hen
 
Posts: 495
Joined: Sun Oct 28, 2007 11:44
Location: the netherlands


Return to Hardware

Who is online

Users browsing this forum: No registered users and 4 guests