LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 08-06-2010, 05:19 PM   #1
veeall
Member
 
Registered: May 2007
Location: Estonia
Distribution: Slackware64-current
Posts: 298

Rep: Reputation: 56
How-to disable hdd spinoffs on a laptop?


Hi!
I have Aspire one 752 netbook with slack 13.1 installed. I installed laptop-mode-tools from slackbuilds to control power management and etc.


I'd like to make sure that sda drive in netbook never spins off when not running on batteries. For now it seems to spin down after every half a minute and is producing clicking sounds. I issued 'hdparm -B 255 /dev/sda' which seemed to work - no clicks any more, and no spinning-up sounds.

What is the right way to make this change to be applied whenever netbook is on AC power?

Thanks for any help, i've heard frequent spin-downs won't do good to a drive.


Edit: Also, how to make this 'hdparm -B 255 /dev/sda' survive hibernate, as it reverts to '96' after being resumed:
# hdparm -B /dev/sda

/dev/sda:
APM_level = 96

Edit2: Ok, i changed hdparm -B values from 254 to 255 in laptop-mode.conf, since values of 254 and any other i tried(1, 96, 128) gave ioctl errors and were not applied to drive.

Code:
# hdparm -B 96 /dev/sda

/dev/sda:
 setting Advanced Power Management level to 0x60 (96)
 HDIO_DRIVE_CMD failed: Input/output error
 HDIO_DRIVE_CMD(identify) failed: Input/output error

# hdparm -B  /dev/sda

/dev/sda:
 APM_level      = off

After these edits it woke up from hibernate with APM_level = off.
Code:
#
# Power management for HD (hdparm -B values)
#
BATT_HD_POWERMGMT=1
LM_AC_HD_POWERMGMT=255
NOLM_AC_HD_POWERMGMT=255

Last edited by veeall; 08-06-2010 at 06:23 PM.
 
Old 08-06-2010, 07:08 PM   #2
piratesmack
Member
 
Registered: Feb 2009
Distribution: Slackware, Arch
Posts: 519

Rep: Reputation: 142Reputation: 142
I didn't use laptop-mode-tools, but here is how I did this on my netbook

1. I created a script: /usr/local/sbin/set-apm.sh
Code:
#!/bin/sh
# sets apm level to 255 on ac_adapter, 128 on battery

STATE=$(awk '{print $2}' /proc/acpi/ac_adapter/*/state)

case $STATE in
  on-line)
    APM=255
  ;;
  off-line)
    APM=128
  ;;
esac

hdparm -B $APM /dev/sda
2. To make sure this script is run on boot, I edited /etc/rc.d/rc.local
Code:
#!/bin/sh
#
# /etc/rc.d/rc.local:  Local system initialization script.
#
# Put any local startup commands in here.  Also, if you have
# anything that needs to be run at shutdown time you can
# make an /etc/rc.d/rc.local_shutdown script and put those
# commands in there.

/usr/local/sbin/set-apm.sh > /dev/null
/etc/rc.d/rc.networkmanager start
/usr/local/sbin/keep-updated.sh &
3. To make the script run whenever I (un)plug the ac adapter, I edited /etc/acpi/acpi_handler.sh
Code:
#!/bin/sh
# Default acpi script that takes an entry for all actions

IFS=${IFS}/
set $@

case "$1" in
  button)
    case "$2" in
      power) /sbin/init 0
         ;;
      lid) /usr/sbin/pm-suspend
         ;;
      *) logger "ACPI action $2 is not defined"
         ;;
    esac
    ;;
  ac_adapter)
    /usr/local/sbin/set-apm.sh
    ;;
  *)
    logger "ACPI group $1 / action $2 is not defined"
    ;;
esac
4. And to make the script run after resuming from suspend/hibernate I created a script: /etc/pm/sleep.d/00-set-apm.sh
Code:
#!/bin/sh

case $1 in
  resume | thaw)
    /usr/local/sbin/set-apm.sh
  ;;
esac
Make sure any scripts you create are executable
 
1 members found this post helpful.
Old 08-07-2010, 07:27 AM   #3
veeall
Member
 
Registered: May 2007
Location: Estonia
Distribution: Slackware64-current
Posts: 298

Original Poster
Rep: Reputation: 56
Thanks, Piratesmack!
It seems laptop-mode-tools handles hibernate fine if 'hdparm -B' is set to 255, for some reason i can't find any working 'hdparm -B' value for my drive except '-B 255'. I've got to see if laptop-mode-tools are able to turn on power management of sda when on batteries. I'll check later when off AC.

I'm sure, without using laptop-mode-tools, Piratesmacks howto would be good solution for the problem. I mark this thread SOLVED.
 
Old 08-08-2010, 02:00 PM   #4
veeall
Member
 
Registered: May 2007
Location: Estonia
Distribution: Slackware64-current
Posts: 298

Original Poster
Rep: Reputation: 56
Quote:
Originally Posted by veeall View Post
...for some reason i can't find any working 'hdparm -B' value for my drive except '-B 255'. I've got to see if laptop-mode-tools are able to turn on power management of sda when on batteries...
No, they didn't. -B value in hdparm stayed on 255(APM OFF). Only when booted with batteries on, it got set to default 96 by bios, i guess.

I found an utility from the net hd-idle which is able to shut this hdd down after given time without relying on hdparm.


EDIT: To summarize. Laptop-mode-tools are disabling Power management for my netbooks HDD by setting 'hdparm -B 255 /dev/sdX' in all laptop power modes, later i can use hd-idle to set my custom timer for spinning down a disk. I found out that the problem i had is probably due to Western Digital hd drive settings and is to be modified by an official utility called 'wdidle3.exe' from a DOS boot disk for example, see here

Last edited by veeall; 08-09-2010 at 07:21 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Installing Ubuntu on laptop HDD without the laptop loadedmind Linux - Laptop and Netbook 5 10-21-2009 03:16 PM
Here's how to disable tap-to-click on laptop touchpads KWTm Ubuntu 3 09-10-2009 09:23 AM
disable suspend when I close the laptop lid lindylex Debian 5 04-14-2009 08:53 AM
How to disable the little marble that is used as a mouse on a laptop keyboard? MrPacane Linux - Laptop and Netbook 4 05-25-2006 01:05 AM
laptop touchpad disable?? linuxhippy Slackware 4 03-13-2005 07:01 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 06:29 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration