# HD spinup:echo 1500 > /proc/sys/vm/dirty_writeback_centisecs

## jeffk

Originally Titled: "HD access every 5 sec in GNOME-2.20, how to disable?"

I have a newly installed ~x86 on a Thinkpad T61p with an SATA hard drive. Under GNOME-2.20, the hard drive accesses every 5 seconds even at idle. This is something I'd like to control and suppress. I don't need or want beagle or other indexing, file alteration monitoring, etc to run when at idle. I'd rather do those things manually, or ideally switch into a 'work mode' where such services are enabled temporarily. I don't think the periodic hard drive access happens when out of X/GNOME, but perhaps it is so fast that the drive light never indicates.

What can I examine to find the offending daemon or library? All options on menu System | Administration | Search and Indexing are unchecked. I'll excerpt some notes of my configuration below:

```
# grep -e 'ACPI\|POWER\|FREQ\|ATA|NO_HZ' kernel-config-x86-2.6.22-gentoo-r8

# Power management options (ACPI, APM)

# ACPI (Advanced Configuration and Power Interface) Support

CONFIG_ACPI=y

CONFIG_ACPI_PROCFS=y

CONFIG_ACPI_AC=m

CONFIG_ACPI_BATTERY=m

CONFIG_ACPI_BUTTON=m

CONFIG_ACPI_VIDEO=m

CONFIG_ACPI_FAN=m

# CONFIG_ACPI_DOCK is not set

CONFIG_ACPI_PROCESSOR=m

CONFIG_ACPI_THERMAL=m

# CONFIG_ACPI_ASUS is not set

# CONFIG_ACPI_TOSHIBA is not set

CONFIG_ACPI_BLACKLIST_YEAR=0

# CONFIG_ACPI_DEBUG is not set

CONFIG_ACPI_EC=y

CONFIG_ACPI_POWER=y

CONFIG_ACPI_SYSTEM=y

# CONFIG_ACPI_CONTAINER is not set

# CONFIG_ACPI_SBS is not set

# CONFIG_APM_REAL_MODE_POWER_OFF is not set

CONFIG_CPU_FREQ=y

CONFIG_CPU_FREQ_TABLE=m

# CONFIG_CPU_FREQ_DEBUG is not set

CONFIG_CPU_FREQ_STAT=m

# CONFIG_CPU_FREQ_STAT_DETAILS is not set

CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y

# CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set

CONFIG_CPU_FREQ_GOV_PERFORMANCE=y

CONFIG_CPU_FREQ_GOV_POWERSAVE=m

CONFIG_CPU_FREQ_GOV_USERSPACE=m

CONFIG_CPU_FREQ_GOV_ONDEMAND=m

CONFIG_CPU_FREQ_GOV_CONSERVATIVE=m

CONFIG_X86_ACPI_CPUFREQ=m

# CONFIG_X86_POWERNOW_K6 is not set

# CONFIG_X86_POWERNOW_K7 is not set

# CONFIG_X86_POWERNOW_K8 is not set

CONFIG_X86_SPEEDSTEP_CENTRINO_ACPI=y

# CONFIG_X86_CPUFREQ_NFORCE2 is not set

# CONFIG_X86_E_POWERSAVER is not set

# CONFIG_X86_ACPI_CPUFREQ_PROC_INTF is not set

CONFIG_PNPACPI=y

CONFIG_THINKPAD_ACPI=m

# CONFIG_THINKPAD_ACPI_DEBUG is not set

# CONFIG_THINKPAD_ACPI_DOCK is not set

CONFIG_THINKPAD_ACPI_BAY=y

# CONFIG_BLK_DEV_IDEACPI is not set

CONFIG_ATA_ACPI=y

# CONFIG_USB_HIDINPUT_POWERBOOK is not set
```

```

# lsmod

Module                  Size  Used by

nvidiafb               44572  0 

fb_ddc                  2880  1 nvidiafb

i2c_algo_bit            6212  1 nvidiafb

vgastate                8000  1 nvidiafb

nvidia               6215144  26 

sg                     29340  0 

intel_agp              23252  0 

i2c_i801                8464  0 

i2c_core               24320  5 nvidiafb,fb_ddc,i2c_algo_bit,nvidia,i2c_i801

agpgart                32388  2 nvidia,intel_agp

snd_hda_intel         237208  1 

snd_pcm                72452  1 snd_hda_intel

snd_timer              21764  1 snd_pcm

snd                    49300  5 snd_hda_intel,snd_pcm,snd_timer

soundcore               8324  1 snd

snd_page_alloc         10376  2 snd_hda_intel,snd_pcm

e1000                 112128  0 

scsi_wait_scan          1664  0 

sbp2                   22152  0 

firewire_core          39112  0 

crc_itu_t               2432  1 firewire_core

ohci1394               32496  0 

ieee1394               86780  2 sbp2,ohci1394

sl811_hcd              12160  0 

usbhid                 26068  0 

ohci_hcd               19972  0 

uhci_hcd               23180  0 

usb_storage            37316  0 

ehci_hcd               28940  0 

usbcore               118956  7 sl811_hcd,usbhid,ohci_hcd,uhci_hcd,usb_storage,ehci_hcd
```

```
# lspci

00:00.0 Host bridge: Intel Corporation Mobile Memory Controller Hub (rev 0c)

00:01.0 PCI bridge: Intel Corporation Mobile PCI Express Root Port (rev 0c)

00:19.0 Ethernet controller: Intel Corporation 82566MM Gigabit Network Connection (rev 03)

00:1a.0 USB Controller: Intel Corporation 82801H (ICH8 Family) USB UHCI Contoller #4 (rev 03)

00:1a.1 USB Controller: Intel Corporation 82801H (ICH8 Family) USB UHCI Controller #5 (rev 03)

00:1a.7 USB Controller: Intel Corporation 82801H (ICH8 Family) USB2 EHCI Controller #2 (rev 03)

00:1b.0 Audio device: Intel Corporation 82801H (ICH8 Family) HD Audio Controller (rev 03)

00:1c.0 PCI bridge: Intel Corporation 82801H (ICH8 Family) PCI Express Port 1 (rev 03)

00:1c.1 PCI bridge: Intel Corporation 82801H (ICH8 Family) PCI Express Port 2 (rev 03)

00:1c.2 PCI bridge: Intel Corporation 82801H (ICH8 Family) PCI Express Port 3 (rev 03)

00:1c.3 PCI bridge: Intel Corporation 82801H (ICH8 Family) PCI Express Port 4 (rev 03)

00:1c.4 PCI bridge: Intel Corporation 82801H (ICH8 Family) PCI Express Port 5 (rev 03)

00:1d.0 USB Controller: Intel Corporation 82801H (ICH8 Family) USB UHCI Controller #1 (rev 03)

00:1d.1 USB Controller: Intel Corporation 82801H (ICH8 Family) USB UHCI Controller #2 (rev 03)

00:1d.2 USB Controller: Intel Corporation 82801H (ICH8 Family) USB UHCI Controller #3 (rev 03)

00:1d.7 USB Controller: Intel Corporation 82801H (ICH8 Family) USB2 EHCI Controller #1 (rev 03)

00:1e.0 PCI bridge: Intel Corporation 82801 Mobile PCI Bridge (rev f3)

00:1f.0 ISA bridge: Intel Corporation Mobile LPC Interface Controller (rev 03)

00:1f.1 IDE interface: Intel Corporation Mobile IDE Controller (rev 03)

00:1f.2 SATA controller: Intel Corporation Mobile SATA AHCI Controller (rev 03)

00:1f.3 SMBus: Intel Corporation 82801H (ICH8 Family) SMBus Controller (rev 03)

01:00.0 VGA compatible controller: nVidia Corporation Unknown device 040c (rev a1)

03:00.0 Network controller: Intel Corporation Unknown device 4230 (rev 61)

15:00.0 CardBus bridge: Ricoh Co Ltd RL5c476 II (rev ba)

15:00.1 FireWire (IEEE 1394): Ricoh Co Ltd R5C832 IEEE 1394 Controller (rev 04)

15:00.2 Generic system peripheral [0805]: Ricoh Co Ltd R5C822 SD/SDIO/MMC/MS/MSPro Host Adapter (rev 21)

15:00.3 System peripheral: Ricoh Co Ltd Unknown device 0843 (rev 11)

15:00.4 System peripheral: Ricoh Co Ltd R5C592 Memory Stick Bus Host Adapter (rev 11)

15:00.5 System peripheral: Ricoh Co Ltd xD-Picture Card Controller (rev 11)

```

```
# rc-update show

            bootmisc | boot                          

             checkfs | boot                          

           checkroot | boot                          

               clock | boot                          

         consolefont | boot                          

                hald |      default                  

            hostname | boot                          

             keymaps | boot                          

               local |      default nonetwork        

          localmount | boot                          

             modules | boot                          

            net.eth0 |      default                  

              net.lo | boot                          

            netmount |      default                  

          postgresql |      default                  

           rmnologin | boot                          

                sshd |      default                  

           syslog-ng |      default                  

             urandom | boot                          

          vixie-cron |      default       
```

```
$ cat /etc/fstab 

# <fs>                  <mountpoint>    <type>          <opts>          <dump/pass>

/dev/sda3               /               ext3            noatime         0 1

/dev/sda1               /boot           ext2            noauto,noatime  1 2

/dev/sda2               none            swap            sw              0 0

/dev/cdrom              /mnt/cdrom      auto            noauto,ro       0 0

shm                     /dev/shm        tmpfs           nodev,nosuid,noexec     0 0
```

```
                                      P-states (frequencies)

< Detailed C-state information is only available on Mobile CPUs (laptops) >

Wakeups-from-idle per second : 91.3     interval: 10.0s                                                                                                

Top causes for wakeups:

  50.0% ( 91.3)       <interrupt> : ahci, uhci_hcd:usb5, nvidia 

  11.9% ( 21.7)       firefox-bin : futex_wait (hrtimer_wakeup) 

   9.6% ( 17.5)                 X : do_setitimer (it_real_fn) 

   7.6% ( 13.9)     mixer_applet2 : schedule_timeout (process_timeout) 

   6.6% ( 12.0)   <kernel module> : usb_hcd_poll_rh_status (rh_timer_func) 

   4.9% (  9.0)       <interrupt> : ide0

   2.3% (  4.2)             irssi : schedule_timeout (process_timeout)

   1.6% (  3.0)     <kernel core> : queue_delayed_work_on (delayed_work_timer_fn)

   1.1% (  2.0)     <kernel core> : clocksource_register (clocksource_watchdog)

   0.6% (  1.1)       <interrupt> : uhci_hcd:usb3, eth0

   0.6% (  1.1)    gnome-terminal : schedule_timeout (process_timeout)

   0.5% (  1.0)                 X : nv_start_rc_timer (nv_kern_rc_timer)

   0.3% (  0.5)          ifconfig : e1000_intr (e1000_watchdog)

   0.3% (  0.5)   hald-addon-stor : schedule_timeout (process_timeout)

   0.3% (  0.5)       firefox-bin : schedule_timeout (process_timeout)

   0.2% (  0.4)             kirqd : schedule_timeout (process_timeout)

   0.2% (  0.3)     <kernel core> : neigh_table_init_no_netlink (neigh_periodic_timer)

   0.2% (  0.3)          nautilus : schedule_timeout (process_timeout)

   0.2% (  0.3)   gnome-settings- : schedule_timeout (process_timeout)

   0.1% (  0.2)              init : schedule_timeout (process_timeout)

   0.1% (  0.2)     <kernel core> : page_writeback_init (wb_timer_fn)

   0.1% (  0.2)    mapping-daemon : schedule_timeout (process_timeout)

   0.1% (  0.2)       gnome-panel : schedule_timeout (process_timeout)

   0.1% (  0.2)          ifconfig : __netdev_watchdog_up (dev_watchdog)

   0.1% (  0.2)   gnome-power-man : schedule_timeout (process_timeout)

   0.1% (  0.1)     <kernel core> : input_event (input_repeat_key)

   0.1% (  0.1)                 X : schedule_timeout (process_timeout)

   0.1% (  0.1)          gconfd-2 : schedule_timeout (process_timeout)

   0.1% (  0.1)       firefox-bin : __make_request (blk_unplug_timeout)

   0.1% (  0.1)     <kernel core> : sk_reset_timer (tcp_delack_timer)

   0.1% (  0.1)             touch : start_this_handle (commit_timeout)

   0.1% (  0.1)          metacity : schedule_timeout (process_timeout)

   0.1% (  0.1)         ssh-agent : schedule_timeout (process_timeout)

Suggestion: Disable 'hal' from polling your cdrom with:

hal-disable-polling --device /dev/scd0 'hal' is the component that auto-opens a

window if you plug in a CD but disables SATA power saving from kicking in.
```

I can't disable CONFIG_USB_SUSPEND kernel configuration option until a SANE release (upstream or Gentoo-patched) fixes the known problem with it. I use scanners a lot.

Also, I usually have irssi with logging running in screen. If there's a long-latency logging option I should be using with that, I'll investigate it.

Thanks for any tips.Last edited by jeffk on Thu Oct 04, 2007 4:45 am; edited 1 time in total

----------

## nixnut

Probably something gnomish that it can't do without like beagle, hal or dbus. Try installing powertop.

----------

## jeffk

The initial post was updated with powertop output, perhaps just after the first reply was started.

I also disabled polling on /dev/cdrom, per powertop recommendations:

```
# ls -al /dev/cdrom

lrwxrwxrwx 1 root root 3 Sep 30 11:04 /dev/cdrom -> hda

# hal-disable-polling --device /dev/hda  

Polling for drive /dev/hda have been disabled. The fdi file written was

  /etc/hal/fdi/information/media-check-disable-storage_serial_HC43_130370.fdi
```

Thanks for any additional tips. I think/hope beagle is disabled per the Search and Index preferences (all unchecked).

----------

## gasparov

Hi jeffk,

   are you sure is an offending service what you are looking for?.My thinkpad and my packard bell laptop have the same issue but is the power management of the harddisk that causes truble

hdparm -B 255 should solve it

Btw if somebody knows how to to this simple thing in windows I would be glad

----------

## PaulBredbury

 *jeffk wrote:*   

> the hard drive accesses every 5 seconds

 

Try thread.

----------

## jeffk

Thanks all, I tried both no-fixed-drives.fdi and hdparm -B 255 (254) /dev/sda. It doesn't change the observed behavior. This may be something other than the loud clicking described by the other users.

This is just a normal quiet hard drive access every 5 or so seconds when idle. I can only hear it because the rest of the machine is so quiet. I think this drive is trying to power down and park the heads, but something is making an unwanted disk request, waking the drive.

I do have 4GB of ram in this machine. I wonder about running without any swap partition mounted. Any thoughts?

```
# mount

/dev/sda3 on / type ext3 (rw,noatime)

proc on /proc type proc (rw,nosuid,nodev,noexec)

sysfs on /sys type sysfs (rw,nosuid,nodev,noexec)

udev on /dev type tmpfs (rw,nosuid)

devpts on /dev/pts type devpts (rw,nosuid,noexec)

shm on /dev/shm type tmpfs (rw,noexec,nosuid,nodev)

usbfs on /proc/bus/usb type usbfs (rw,noexec,nosuid,devmode=0664,devgid=85)

/dev/sda1 on /boot type ext2 (rw,noatime)
```

```
# cat /etc/fstab 

# <fs>                  <mountpoint>    <type>          <opts>          <dump/pass>

/dev/sda3               /               ext3            noatime         0 1

/dev/sda1               /boot           ext2            noauto,noatime  1 2

/dev/sda2               none            swap            sw              0 0

/dev/cdrom              /mnt/cdrom      auto            noauto,ro       0 0

shm                     /dev/shm        tmpfs           nodev,nosuid,noexec     0 0
```

P.S. I just entered the contents of no-fixed-drives.fdi into the file, no special EOF tricks. This should be the same thing, right?

----------

## jeffk

OK, I read up on it a bit, and running without swap isn't the answer.

Also, I thought I'd mention that the HD access light does come on during these periodic accesses, so it appears to be a data-driven event, and not an internal drive event like a thermal recalibration.

Also, the accesses happen when I leave X / GNOME, and am back at the console.

Finally, not running irssi, with its logging, does not eliminate the periodic disk accesses.

I need some ubertool that logs disk access events. Without accessing the disk  :Wink:  .

This is becoming an example of the Heisenberg Uncertainty Principle.

----------

## jeffk

powertop to the rescue! Recommended:

```
Suggestion: increase the VM dirty writeback time from 4.99 to 15 seconds with:

  echo 1500 > /proc/sys/vm/dirty_writeback_centisecs

This wakes the disk up less frequenty for background VM activity
```

I did this, and sure enough, the quiet disk access happens about every 15 seconds.

How far can I push this setting for normal latoptop usage on a 4Gb machine?

How do I move this into a permanent setting enabled at boot-time?

Is there a kernel config to optimize it?

```
# grep VM kernel-config-x86-2.6.22-gentoo-r8 

CONFIG_VM_EVENT_COUNTERS=y

CONFIG_VM86=y

# Multi-device support (RAID and LVM)

# CONFIG_KVM is not set

# CONFIG_DEBUG_VM is not set
```

Also, as an aside, powertop recommended:

```
Suggestion: Disable the CONFIG_IRQBALANCE kernel configuration option.

The in-kernel irq balancer is obsolete and wakes the CPU up far more than needed.
```

Which I'm going to fix. Gives me a chance to check out the "/" menuconfig search, which is SO handy, I can't believe I didn't notice it before.

```
# grep IRQ kernel-config-x86-2.6.22-gentoo-r8 

CONFIG_IRQBALANCE=y

CONFIG_HT_IRQ=y

CONFIG_IDEPCI_SHARE_IRQ=y

CONFIG_HPET_RTC_IRQ=y

CONFIG_TRACE_IRQFLAGS_SUPPORT=y

# CONFIG_DEBUG_SHIRQ is not set

CONFIG_GENERIC_HARDIRQS=y

CONFIG_GENERIC_IRQ_PROBE=y

CONFIG_GENERIC_PENDING_IRQ=y
```

----------

