Wednesday, 22 July 2009

Hard Disc Drive

HDD is next opportunity too get some extra minutes working on battery. Nowadays most of disc drives supports power saving modes especially SATA discs which uses less power than PATA during data transmission. There are many methods to save power, you can reduce transmission, change read-ahead, spin down drive or even turn off motor. Most known program is hdparm which supports all above options and many others. Worth attention is -S time option putting drive into idle mode, and also sets time determining how long to wait (with no disc activity) before turning off the motor. It may save a lot of power but you need use some other tricks which reduces the frequency of using disc drive. Below I listed most important (in my opinion):

  • add option noatime for each mounted partition in /etc/fstab configuration file
  • if you have enough RAM memory, you may disable swap partition by putting # in /etc/fstab file at the beginning of line responsible for mounting swap file system
  • set read-ahead using command hdparm -a [value] /dev/[your disc]  'value' should be large but not too much (I have 24576)
  • stop system message loggers like syslogd syslog-ng rsyslogd

All these things do laptop_mode, but this is subject for other post.

If you want to find out which process get access to your disc use following commands (as root)

kamil@lap ~ $ su
lap kamil # echo 1 > /proc/sys/vm/block_dump
lap kamil # dmesg | tail
[ 9956.024000] pdflush(31): WRITE block 17040472 on sda1
[ 9956.024009] pdflush(31): WRITE block 17125584 on sda1
[ 9956.024043] pdflush(31): WRITE block 17170536 on sda1
[ 9956.024062] pdflush(31): WRITE block 0 on sda1
[ 9956.024073] pdflush(31): WRITE block 8 on sda1
[ 9956.030421] kjournald(46): WRITE block 11191960 on sda8
[ 9956.030692] kjournald(46): WRITE block 18694768 on sda8
[ 9956.030709] kjournald(46): WRITE block 18694776 on sda8
[ 9956.031003] kjournald(46): WRITE block 18694784 on sda8
[ 9958.427068] foobar2000.exe(5863): READ block 102237108 on sda5


   Hardware: 160GB 5400 rpm 2,5" SATA

   Notice: Graph isn't ideal, cause influence other section of laptop like fan, cpu etc.

hard disc drive power consumption
Most important options of hdparm:


     hdparm  [option]  [device]


     -a  Get/set amount of sectors for filesystem read-ahead

     -B  Query/set Advanced Power Management feature, if it is supported. A low value means aggressive power management and higher means better performance. Possible values range from 1 to 127 (permit spin-down) and values from 128 to 254 (do not permit spin-down). A value of 255 disables  Advanced Power Management.

     -I  Returns detailed info directly from the drive.

     -S  Put drive into idle mode, and also sets time determining how long to wait (with no disc activity) before turning off the motor


     Be careful using hdparm, some of options are very dangerous and may damage your hardware!


Post a Comment