<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xml:base="http://www.jenitennison.com/blog" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
 <title>hardware</title>
 <link>http://www.jenitennison.com/blog/taxonomy/term/32</link>
 <description>The taxonomy view with a depth of 0.</description>
 <language>en</language>
<item>
 <title>Minimising hard-disk power consumption</title>
 <link>http://www.jenitennison.com/blog/node/51</link>
 <description>&lt;p&gt;Me: You know that new laptop I was talking about? The &lt;a href=&quot;http://www.dell.com/content/products/productdetails.aspx/xpsnb_m1330&quot; title=&quot;Dell XPS M1330&quot;&gt;Dell XPS M1330&lt;/a&gt;? The one where you can get it with a 32Gb solid-state drive?&lt;/p&gt;

&lt;p&gt;Him (wary): Yeeesss&amp;#8230;&lt;/p&gt;

&lt;p&gt;Me: Well listen to &lt;a href=&quot;http://news.digitaltrends.com/news/story/12556/samsung_announces_64_gb_solid_state_drive&quot; title=&quot;Digital Trends: Samsung Announces 64Gb Solid State Drive&quot;&gt;this&lt;/a&gt;: &amp;#8220;a 64 GB solid-state drive can read 64 MB/S, write 45 MB/s, and consumes just half a Watt when operating (one tenth of a Watt when idle). In comparison, an 80 GB 1.8-inch hard drive reads at 15 MB/s, writes at 7 MB/s, and eats 1.5 Watts either operating or when idle.&amp;#8221;&lt;/p&gt;

&lt;p&gt;Him: So what you&amp;#8217;re saying is, if you get this laptop you&amp;#8217;ll be saving the planet.&lt;/p&gt;

&lt;p&gt;Me: Precisely!&lt;/p&gt;

&lt;!--break--&gt;

&lt;hr /&gt;

&lt;p&gt;Until such time as I can afford said Dell, I&amp;#8217;m trying other ways of limiting the power consumption of our computer equipment. I &lt;a href=&quot;http://www.jenitennison.com/blog/node/46&quot; title=&quot;here, a week ago, in &#039;And she&#039;s back&#039;&quot;&gt;mentioned&lt;/a&gt; that my dad&amp;#8217;s set me up nicely with a &lt;a href=&quot;http://en.wikipedia.org/wiki/NSLU2&quot; title=&quot;Wikipedia: NSLU2&quot;&gt;NSLU2&lt;/a&gt;. One of its USB ports has a 2Gb USB key stuck in it: that holds the core operating system. The other&amp;#8217;s got a 500Gb hard drive attached to it; that holds the data.&lt;/p&gt;

&lt;p&gt;The NSLU2 acts as my file server and mail server. It runs all the time, so one of its attractions is its low power consumption. But having a hard drive spun-up all the time isn&amp;#8217;t very efficient, particularly during the night when there&amp;#8217;s no need for constant disk access and the noise might disturb people sleeping in the spare room where the server&amp;#8217;s located. On the other hand, you don&amp;#8217;t want to do a huge amount of spinning up and spinning down because it strains the hardware.&lt;/p&gt;

&lt;p&gt;The disk Barry (my dad) bought powers down after about 15 minutes of non-activity. Which is great, until you realise that what you think of as non-activity (&amp;#8220;I&amp;#8217;m not even logged in!&amp;#8221;) isn&amp;#8217;t what counts. Background processes writing to logs is enough to keep the disk spun up.&lt;/p&gt;

&lt;p&gt;So the first challenge was to identify those processes that were writing to disk and keeping it spun up. Barry wrote the following script to do it:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;#!/bin/sh

# script by barry, intended for cron.hourly,
# to log (under /root/disk-access-logs)
#  (without accessing the hd unnecessarily)
# the atime and mtime of
# files on /var (one partition of the mounted usb-hd)
# which have been accessed in the last hour

# AND (later, maybe temporarily also) the value in 
#  /var/lib/ntp/ntp.drift to a different logfile

# LOG_FILE=log-`date +%y%m%d-%H%M`

LOG_FILE=/root/disk-access-logs/log-`date +%y%m%d`
[ -f $LOG_FILE ] || touch $LOG_FILE

echo &quot;Result of:  find /var -mmin -59 -printf &quot;%a %t %p\n&quot; |sort -t &quot;:&quot; -k4nr -k5nr&#039; at:&quot; &amp;gt;&amp;gt;$LOG_FILE
echo `date +%y%m%d-%H%M` &amp;gt;&amp;gt;$LOG_FILE
find /var -mmin -59 -printf &quot;%a %t %p\n&quot; |sort -t &quot;:&quot; -k4nr -k5nr &amp;gt;&amp;gt;$LOG_FILE
echo &quot;------&quot; &amp;gt;&amp;gt;$LOG_FILE
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;This reveals things like &lt;a href=&quot;http://en.wikipedia.org/wiki/Fetchmail&quot; title=&quot;Wikpedia: fetchmail&quot;&gt;fetchmail&lt;/a&gt; (pretty obviously) writing every five minutes when it wakes up to check for new mail on my POP3 server. It reveals &lt;a href=&quot;http://en.wikipedia.org/wiki/Exim&quot; title=&quot;Wikipedia: exim&quot;&gt;exim&lt;/a&gt; writing to its log every half hour. It reveals &lt;a href=&quot;http://en.wikipedia.org/wiki/Network_Time_Protocol&quot; title=&quot;Wikipedia: Network Time Protocol&quot;&gt;ntp&lt;/a&gt; collecting statistics (and, still unresolved, writing to &lt;code&gt;daemon.log&lt;/code&gt; in the early hours of the morning). It also revealed that &lt;a href=&quot;http://us3.samba.org/samba/&quot; title=&quot;Samba website&quot;&gt;Samba&lt;/a&gt;, which we&amp;#8217;d previously been using to give me Windows-based access to the hard drives, was doing a lot of logging, and this was part of the reason we stopped using it. And that &lt;a href=&quot;http://en.wikipedia.org/wiki/Syslog&quot; title=&quot;Wikipedia: syslog&quot;&gt;syslog&lt;/a&gt; was also logging frequently.&lt;/p&gt;

&lt;p&gt;The ntp logging was minimised by editing &lt;code&gt;/etc/ntp.conf&lt;/code&gt; and the syslog logging by setting a long &amp;#8220;mark&amp;#8221; interval in &lt;code&gt;/etc/default/syslogd&lt;/code&gt;. Having a &lt;a href=&quot;http://en.wikipedia.org/wiki/Cron&quot; title=&quot;Wikipedia: cron&quot;&gt;cron&lt;/a&gt; job that stops all the processes that don&amp;#8217;t need to be constantly running overnight is working reasonably well at the moment. My crontab currently looks like this:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;# Fixed the PATH to provide access to start-stop-daemon, 
# env and rm that /etc/init.d/exim4 requires

PATH=/usr/bin:/bin:/sbin:$PATH

# m h  dom mon dow   command
00 23 * * * /etc/init.d/fetchmail stop &amp;gt; /dev/null &amp;amp;
00 23 * * * /etc/init.d/exim4 stop &amp;gt; /dev/null &amp;amp;
00 07 * * * /etc/init.d/exim4 start &amp;gt; /dev/null &amp;amp;
00 07 * * * /etc/init.d/fetchmail start &amp;gt; /dev/null &amp;amp;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;but I&amp;#8217;m probably going to tweak it to take care of the ntp thing and to remain spun down on days when I&amp;#8217;m not constantly at the computer.&lt;/p&gt;

&lt;p&gt;Any other ideas?&lt;/p&gt;
</description>
 <comments>http://www.jenitennison.com/blog/node/51#comments</comments>
 <category domain="http://www.jenitennison.com/blog/taxonomy/term/32">hardware</category>
 <category domain="http://www.jenitennison.com/blog/taxonomy/term/23">environment</category>
 <pubDate>Sun, 19 Aug 2007 21:00:09 +0100</pubDate>
 <dc:creator>Jeni</dc:creator>
 <guid isPermaLink="false">51 at http://www.jenitennison.com/blog</guid>
</item>
</channel>
</rss>
