2

I'm using Debian Wheezy

No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux 7.3 (wheezy)
Release:    7.3
Codename:   wheezy


$ uname -a
Linux debian 3.2.0-4-amd64 #1 SMP Debian 3.2.51-1 x86_64 GNU/Linux

on Lenovo G580 with Seagate 1TB Hard Disk. The problem I'm facing is that the hard disk spins down and up too frequently when on battery. I tried using hdparm and used the following commands, but that didn't work. Also installed laptop-mode and edited laptop-mode-conf to

LM_AC_HD_IDLE_TIMEOUT_SECONDS=2000
LM_BATT_HD_IDLE_TIMEOUT_SECONDS=2000
NOLM_HD_IDLE_TIMEOUT_SECONDS=7200

after reading similar posts, but that too didn't work, and so, I uninstalled it.

Rui F Ribeiro
  • 55,929
  • 26
  • 146
  • 227
M4ver1k
  • 121
  • 1
  • 3
  • Assuming you tried these things? http://superuser.com/questions/555400/what-do-different-values-of-hard-drives-advanced-power-management-feature-hdpa – slm Dec 30 '13 at 17:24
  • but will it be in effect when the laptop is running on battery than AC ? – M4ver1k Dec 30 '13 at 18:49

1 Answers1

2

The cause is hdparm, there is a bug in there that spins down the HDD in 3-5 sec when idle. This has been known in hdparm since 2012 and reported fixed. Now it causes the same problems in Debian Wheezy (for me it was Debian 7.6 and not before that initial upgrade to 7.6).

Solution:

  • check what level you power management is on (Advanced power management level) with hdparm -I /dev/sdb | grep level

  • open /etc/hdparm.conf and change the level to 128 on battery for -B, read the file comments on how to do this properly (examples below in permanent solution)

  • alternatively if you don't want to edit the file, just run the command hdparm -B 128 /dev/sdb for your drive and set the Advanced power management level to prefer performance over power conservation

  • if you don't want to touch the power management, run the command hdparm -S 24 /dev/sda (*24*5=120 seconds*) and change the spindown time to a value of your choice.

For a more permanent solution add this block to your /etc/hdparm.conf file

command_line {
     hdparm -B 255 /dev/sda
}

or this block

/dev/sda {
     apm_battery = 128
}

Then restart your hdparm deamon via service hdparm restart or /etc/init.d/hdparm restart. Reboot for verification.

Check the man pages for an explanation of all of the above commands.

Secko
  • 276
  • 1
  • 8
  • currently what i do is hdparam -B 255 /dev/sda and hdparam -S 255 /dev/sda. which turns off APM and sets the time offset to 21 mins.But have to do this everytime laptop go on battery as it gets reset when back on AC. – M4ver1k Jul 20 '14 at 17:02
  • 1
    Yes it resets it back, but it fixed the problem for me nonetheless. It doesn't spindown the hdd anymore when on battery. – Secko Jul 20 '14 at 18:34
  • yes it does solve the issue for me too but, was looking for a permanent solution. – M4ver1k Jul 20 '14 at 18:35
  • No, I meant to say that it solves it permanently even after I switch back to AC power and hdparm resets the APM value. When I switch back to battery, although the APM remains the same I don't need to change it as I find that the hdd doesn't spindown anymore. – Secko Jul 20 '14 at 19:28
  • One more thing, I also disabled hdd spindown in my GUI power manager for both AC and battery power (Xfce for me). It seams to be working well with hdparm. Try removing hdparm altogether and see if your hdd spinsdown then. You can always install it again and reconfigure. – Secko Jul 20 '14 at 19:44
  • I have changed my answer, try the permanent solution which I have already mentioned in the answer before. – Secko Jul 21 '14 at 14:13