BULMA Bulma amb el projecta Defective by Desing
Bergantells Usuaris de GNU/Linux de Mallorca i Afegitons   |   Bisoños Usuarios de GNU/Linux de Mallorca y Alrededores
CONTENIDOS
. Jornadas de software libre
. Version para PDA
. Enlaces breves
. La asociacion
. Los mas leidos
. Autores [Actividad]
. Ultimos Comentarios
. Todos los titulares!
. Estadisticas
. Guia de estilo
. ¿Sugerencias?
. Wiki
. XML [Ayuda]
Listas de correo
. Archivos bulmailing
. Archivos BulmaGes
Radio libre :-)
. Des de la Xarxa (Archivos)
. Mallorca en Xarxa
Busquedas

+ Enlaces Linux
Ultimos kernels
(01/08/2010 05:10:59)
    
Google


En bulma.net
En internet
Extend the battery life of your (iBook) laptop (26073 lectures)
Por Ricardo Galli Granada
gallir (http://mnm.uib.es/gallir/)
Creado el 21/09/2002 01:27 modificado el 21/09/2002 01:27

One of the aspects to solve to save the laptop's battery is that the disk must be spun down as long as enough time has passed without disk activity. Usually it is difficult to make it work, especially with journaled systems because noflush daemons don't prevent writes in the file system journal. I describe here some techniques to solve it, and altough I describe in this article how to do it in a Apple iBook with Ext3 (Debian Sid), it would be useful for any other Linux laptop.
Although you could be not interested in energy saving (is your laptop normally plugged?), another additional advantage is that we will extend the life of the hard disk, since the laptop's disks are not designed to spin continuously.

Pagina1/1

This is a very fast and unchecked translation of my previous article in Spanish. Forgive me the English mistakes, it is almost 2 am :-).
Versión en castellano

First of all, traditional daemons, like noflushd, that spin down the disks or prevent disk writes, have almost no effectivity for Ext3 or ReiserFS journaled filesystems. This is due to that the operating system writes to the journal if there is any pending write.

I was "fighting" for a long time with ext3, trying to spin the disk down playing with different hdparm setups. I thought that it was its fault, the disk did not stop. As in iBook the only piece in movement is the disk and the CPU almost does not warm up, all the noise (in fact very little) and the heat come from the disk.

In my previous configuration (until few days ago), I had disabled ext3 and returned back to ext2 with noflushd, because they produced a lot better results. But I don't blame to Ext3 anymore... it was noflushd that masked the generation of "unnecessary" logs (my portable one is not a server:-) of syslogd and statistics of the NTP. In addition, as my laptop is connected to my home wireless network, which has a DHCP server in the Linux access point, whenever the IP is renegotiated, syslogd generated several log lines (I first solved it increasing the leasing period in the DHCP server).

Basically, we are going to do three things:

  1. To indicate to the system not to store the files' access time (noatime).
  2. To prevent syslogd from storing not "interesting" log lines.
  3. To prevent other programs to generate logs, specially ntpd (which does it with its default configuration in Debian).

noatime

By default, the file systems stores in the files' i-node the last access time. That means that whenever a file is read, it generates an write operation. If you are not interested in keeping that information (normally you aren't, at least you have some tricky mail program), you can specify the "noatime" option in /etc/fstab for every disk file system (i.e. don't do it for /proc or swap partitions). For example:

# /etc/fstab: static file system information.
#
/dev/hda4	/	ext3	defaults,noatime	0	1

syslogd

I prevented syslogd to generate most of uninteresting lines, like DHCP negotiations, bad sized packets in the wireless network, crond logs every minute, etc. Find below my syslogd.conf version, note that it is hardly conservative.

You will see that the most frequent sources of logs are sent to /dev/null, for the others I added minus ("-") to the begining of the filename, so syslogd doesn't sync them for every line.

#  /etc/syslog.conf     Configuration file for syslogd.
#
#                       For more information see syslog.conf(5)
#                       manpage.

#
auth,authpriv.*                 /dev/null
*.*;auth,authpriv.none          /dev/null
cron.*                          /dev/null
daemon.*                        /dev/null
*.=debug;\
        auth,authpriv.none;\
        news.none;mail.none     /dev/null
*.=info;*.=notice;*.=warn;\
        auth,authpriv.none;\
        cron,daemon.none;\
        mail,news.none          /dev/null

kern.*                          -/var/log/kern.log
lpr.*                           -/var/log/lpr.log
mail.*                          -/var/log/mail.log
user.*                          -/var/log/user.log
uucp.*                          -/var/log/uucp.log



#
# Emergencies are sent to everybody logged in.
#
*.emerg                         *

daemon.*;mail.*;\
        news.crit;news.err;news.notice;\
        *.=debug;*.=info;\
        *.=notice;*.=warn       |/dev/xconsole

ntpd other programs

In spite I've been radikal ignoring most of the logs, I still found frequent writes with vmstat. I checked every daemon, program and cron entry, and was surprised to discover that ntpd was the source of most writes. It was storing protocol statistics in /var/log/ntpstats.

So, to avoid it, check the following lines in ntp.conf are commented out:

#statsdir /var/log/ntpstats/

#statistics loopstats peerstats clockstats
#filegen loopstats file loopstats type day enable
#filegen peerstats file peerstats type day enable
#filegen clockstats file clockstats type day enable

Other "dangerous" programs

There are also other programs and daemons that generate disk writes. I can't give a general recipe because it depends on your installed packages and configurations. Nevertheless, check the following programs:

  • exim: it generates logs every time it executes to chech the pending jobs in the queue. By default it executes every 15 minutes, I've changed it to 1 hour in /etc/crond.d/exim.
  • cups: it writes periodically in /var/spool/certs/.
  • modutils: modutils package comes with a script that is periodicallyexecuted from /etc/cron.daily/modutils, /sbin/insmod_ksymoops_clean which output to several files in /var/log/ksymoops.

Last words

Check the file system activity in your laptop with vmstat period, especially the bo columns, which shows the block outs to the disk.

And, check you've configured the power control as I described in this article. With the configuration and packages described in both articles, your battery will last 5 hours, or more...


Only 5 hours and 20 minutes left :-)

Imprimir
Version para
imprimir

Imprimir
Version
PDF
Comentarios
Es posible que se hayan omitido algunos comentarios considerados poco constructivos
1.  Re: Extend the battery life of your (iBook) laptop (21/09/2002 04:37, #8578)
  Por: El cobarde anónimo
Home, el dels sistemes de fitxers amb journaling mosqueja però el demés es aplicable fins i tot quan es desitga estalbiar recursos en maquinari antic. Molt bon article!

 
2.  Re: Extend the battery life of your (iBook) laptop (28/08/2004 12:43, #23054)
  Por: Wee-Jin Goh
Spinning down the hard disk doesn't necessarily improve the battery life. It takes far more power to spin up the hard disk and could cause more wear and tear in the process as well.

 
3.  Re: Extend the battery life of your (iBook) laptop (18/04/2005 09:51, #26280)
  Por: Anònim
Debieras modernizar esto ya que /var/log/ntpstats/ntp.conf no existe en ubuntu hoary, y tampoco creo que existe en sarge. Tambien, si pudieras explicar lo ultimo con exim, etc, estariamos agradecido. Lo demas fue provechoso, pero solo recobr'e 7 minutos en my ibook del 2004. Mi ibook dura 5+ horas con OS X panther, pero solo dura 3:30 en ubuntu. Considerando que apple solo ha podido crear un ibook que dura 5 hrs ahora ultimo, encuentro dificil creer que tu tienes xpmumon indicando 5 hours en ibook.pb desde 2002! Que pasa con esto?

 
GRACIAS
Distribuciones Universal
Por el servidor
Dpto. de Matematicas e Informatica
Calificacion
****
Vots: 21
Danos tu opinion:
**** Excelente
***0 Muy Bueno
**00 Bueno
*000 Regular
0000 Malo
Relacionados
. cpudyn: controlar la velocidad de la CPU automáticamente
. Ahorrar energía del portátil (iBook)
SECCIONES
Noticia
Breve
Truco
Enlace
Participa
Proyecto
Articulo
Webbulma
Manoletada :-)
Seguridad
Modificado: 10/3/2010 17:23:40 | Tiempo Total: 0.047 segs | Kernel: Linux - i686 - 2.6.26-1-686 | Last boot: 27/12/2009 22:08 CET
Powered by Apache    MySQL    PHP    Gimp