[ltp] apm --standby and an other 'problem'

Steve Stavropoulos linux-thinkpad@linux-thinkpad.org
Thu, 12 Feb 2004 20:52:49 +0200 (EET)


On Thu, 12 Feb 2004, Marius Gedminas wrote:

> On Thu, Feb 12, 2004 at 10:22:16AM +0100, Konstantin wrote:
> > Another linux not thinkpad Problem:
> > If I use my thinkpad under terminal, the harddisk is quit and stays on
> > standby mode, I hear not one sound of my thinkpad, but if I start
> > Xwindows(whatever xfce, kde, gnome) a process writes or read something
> > of the hd, so it spins up every 30 seconds and then goes to standby
> > mode again. Yes this kill my nerves, the harddisk and the battery :(
> 
> I have the same problem.  Even in single user mode, with all daemons
> stopped and / mounted noatime, the disk would still spin up.
> 

 You have to tune the /proc/sys/vm/bdflush option so ext3 won't write it's 
journal every 5 seconds which is the default. The following line should do 
the trick:
 echo "30 500 0 0 90000 90000 60 20 0" > /proc/sys/vm/bdflush
With this, the journal will be written every 15 minutes. (you still need 
laptop-mode=1 for best results...)
 The following apmcontinue script will be of great help I think:

#!/bin/sh

case $1 in
  standby|suspend)
    ;;          
  resume)
    ;;          
  change)
    case $2 in  
      power)            
        if apm | LC_ALL=C grep -q on-line &>/dev/null; then
          echo "30 500 0 0 500 3000 60 20 0" > /proc/sys/vm/bdflush
          hdparm -S 0 /dev/hda          
        else
          echo "30 500 0 0 90000 90000 60 20 0" > /proc/sys/vm/bdflush
          hdparm -S 12 /dev/hda 
        fi                              
        ;;
      battery)                          
        ;;                      
    esac                        
    ;;                  
  start)                        
    if apm | LC_ALL=C grep -q on-line &>/dev/null; then
      echo "30 500 0 0 500 3000 60 20 0" > /proc/sys/vm/bdflush
      hdparm -S 0 /dev/hda
    else
      echo "30 500 0 0 90000 90000 60 20 0" > /proc/sys/vm/bdflush
      hdparm -S 12 /dev/hda
    fi
    ;;
  stop)
    ;;
esac

 Copy it to /etc/sysconfing/apm-scripts/apmcontinue and at least in 
redhat/fedora it will be automatically used.
 The odd thing is that fedora took a great deal of time to put the
laptop-mode patch in the kernel but failed to provide an apm script that
takes advantage of it. Not even an hdparm -S >0...