IdleDisk

Summary

Ubuntu puts the laptop into laptop mode if acpi is properly set up and the laptop begins to run on batteries. Laptop mode causes all disk writes to be held in memory until a cache miss, forced write or 10 minutes without disk activity. It also re-mounts journaling file with the commit=600.

To put the laptop into laptop mode manually, laptop-mode start can be run. Disk activity can be monitored with the sysctl variable vm.block_dump.

The daemons installed with ubuntu-desktop do not force any regular disk writes, with 2 exceptions:

Sysklogd: /etc/syslog.conf

The default configuration sets some files to be synchronously accessed, namely:

  • /var/log/auth.log
  • /var/log/mail.err
  • etc ...

Most of these are for errors, so should only trigger disk access when there is something wrong. An exception is auth.log which is written when a user cron task runs, so perhaps this is important.

Perhaps these can be set to asynchronous writing on installation if laptop-detect detects a laptop?

Postfix:/var/spool/postfix

By default postfix tries to set chattr -S on its mail queues in /var/spool/postfix. Could this be changed for a for a laptop installation?

Otherwise there are some non-daemon programs that cause disk spin ups on a regular basis:

vim: swap files

By default vim writes to its swap file every 200 characters in a synchronous way. This can be changed by :set uc=x where x is the number of characters or 0 to disable writing swap files. Perhaps a defult vim setup to detect if the laptop is in laptop mode?

Other ideas

  • Now that anacron is part of ubuntu-desktop, it is probably a good idea to
    • disable some jobs from running when off-line, the same for cron.

Testing

Tests were run for the ubuntu-desktop to detect which programs caused disk spin-ups:

Coverage:

  • cpid, cron, dbus, hotplug, inetd, mdadm, sysklogd, atd, cupsys, evms, ifup, klogd, postfix, vim

Package

Program

File

Period /sec

System Call/Access Type

sysklogd

/sbin/syslogd

/var/log/auth.log,/var/log/cron.log,/var/log/uucp.log,/var/log/uucp.log,/var/log/mail.err,/var/log/news/news.crit,/var/log/news/news.err

on write

fsync

at

/usr/sbin/atd

/var/spool/cron/atjobs

3600

stat64

cron

/usr/sbin/cron

crontabs, /etc/crontab, /etc/cron.d/*

60

stat64

cupssys

/usr/sbin/cupsd

/etc/cups/certs/0,/etc/group

300

unlink, open

mdadm

/sbin/mdadm

?/proc/mdstat?

60

fstat64

postfix

/var/spool/postfix/incoming/,public/qmgr

300

open,fstat64

postfix

public/pickup, maildrop

60

open, fstat64, lstat64

vim

/usr/bin/vim

$file.bak, $file, /tmp/v*

on write

a lot + fsync

Also, here is the output of /var/log/syslog when /proc/sys/vm/block_dump = 1 showing 10 minutes of idle disk activity.

10 minutes without writing to disk::

  Dec 13 00:22:33 minipas kernel: pdflush(55): WRITE block 13638776 on hda2
  Dec 13 00:23:51 minipas dhclient: DHCPREQUEST on wlan0 to 204.254.239.1 port 67
  Dec 13 00:23:51 minipas dhclient: DHCPACK from 204.254.239.1
  Dec 13 00:23:51 minipas dhclient: bound to 204.254.239.20 -- renewal in 269 seconds.
  Dec 13 00:23:51 minipas kernel: master(5692): dirtied inode 97065 (qmgr) on hda2
  Dec 13 00:23:51 minipas kernel: master(5692): dirtied inode 97064 (pickup) on hda2
  Dec 13 00:23:51 minipas kernel: cupsd(5402): dirtied inode 6255 (0) on hda2
  Dec 13 00:23:51 minipas kernel: syslogd(5131): dirtied inode 96977 (daemon.log) on hda2
  Dec 13 00:23:51 minipas kernel: syslogd(5131): dirtied inode 96977 (daemon.log) on hda2
  Dec 13 00:23:51 minipas kernel: dhclient-script(6655): dirtied inode 97077 (resolv.conf.dhclient-new) on hda2
  Dec 13 00:23:51 minipas kernel: dhclient-script(6655): dirtied inode 97077 (resolv.conf.dhclient-new) on hda2
  Dec 13 00:23:51 minipas kernel: chmod(6664): dirtied inode 97077 (resolv.conf.dhclient-new) on hda2
  Dec 13 00:28:20 minipas dhclient: DHCPREQUEST on wlan0 to 204.254.239.1 port 67
  Dec 13 00:28:20 minipas dhclient: DHCPACK from 204.254.239.1
  Dec 13 00:28:20 minipas dhclient: bound to 204.254.239.20 -- renewal in 280 seconds.
  Dec 13 00:32:17 minipas kernel: dhclient3(4830): dirtied inode 97024 (dhclient.wlan0.leases) on hda2
  Dec 13 00:32:19 minipas kernel: dhclient3(4830): dirtied inode 97024 (dhclient.wlan0.leases) on hda2
  Dec 13 00:32:19 minipas kernel: cupsd(5402): dirtied inode 6255 (0) on hda2
  Dec 13 00:32:19 minipas kernel: dhclient-script(6719): dirtied inode 6366 (resolv.conf.dhclient-new) on hda2
  Dec 13 00:32:19 minipas kernel: dhclient-script(6719): dirtied inode 6366 (resolv.conf.dhclient-new) on hda2
  Dec 13 00:32:19 minipas kernel: chmod(6728): dirtied inode 6366 (resolv.conf.dhclient-new) on hda2
  Dec 13 00:32:19 minipas kernel: pdflush(55): WRITE block 13678024 on hda2


CategoryLookMergeDelete

IdleDisk (last edited 2008-08-06 16:27:50 by localhost)