<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>The ongoing struggle</title>
	<atom:link href="http://strugglers.net/~andy/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://strugglers.net/~andy/blog</link>
	<description>I'll get there one day.</description>
	<lastBuildDate>Sun, 14 Mar 2010 15:24:32 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=3.0-alpha</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Coping with busy mailing lists with Mutt</title>
		<link>http://strugglers.net/~andy/blog/2010/03/14/coping-with-busy-mailing-lists-with-mutt/</link>
		<comments>http://strugglers.net/~andy/blog/2010/03/14/coping-with-busy-mailing-lists-with-mutt/#comments</comments>
		<pubDate>Sun, 14 Mar 2010 15:14:04 +0000</pubDate>
		<dc:creator>Andy</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Rant]]></category>

		<guid isPermaLink="false">http://strugglers.net/~andy/blog/?p=495</guid>
		<description><![CDATA[I&#8217;m on a couple of fairly busy mailing lists which by their nature have loose or no moderation. It&#8217;s natural that some mailing lists work well with tight moderation, even perhaps requiring every post to be approved, but it&#8217;s more common for there to be little or no moderation. This is not a bad thing; [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m on a couple of fairly busy mailing lists which by their nature have loose or no moderation. It&#8217;s natural that some mailing lists work well with tight moderation, even perhaps requiring every post to be approved, but it&#8217;s more common for there to be little or no moderation. This is not a bad thing; people have very different ideas about what sort of posts are interesting.</p>
<p>As a consequence though, I tend to find that many (sometimes the majority) of posts are uninteresting. Clearly if they are <em>all</em> uninteresting then I need to just unsubscribe, but I&#8217;m on plenty of lists that do come up with gems from time to time. I find <a href="http://mutt.org/">Mutt</a>, the text-based (console) email client to be really helpful at quickly getting through these mailing lists without missing too many interesting things, and I thought I&#8217;d share some ways I do that.</p>
<p>These are primarily simple tips for dealing with other people&#8217;s sub-optimal mailing list behaviour. In some cases it&#8217;s the poster who&#8217;s clearly in the wrong, but asking people to give a toss about those reading their words of wisdom is apparently considered offensive in many places, and doesn&#8217;t actually modify behaviour.</p>
<p>First off, Mutt is kind of a culture shock for most people. This post is only really for people who already use Mutt, or maybe who were already considering using it. I&#8217;m not even going to try convincing the typical gmail web user to switch. Or anyone really. Depending on how you configure it, Mutt looks a bit like this:</p>
<p><a href="http://gallery.strugglers.net/v/Andy/Screenshots/mutt.png.html?g2_imageViewsIndex=3"><img src="http://gallery.strugglers.net/d/8015-4/mutt.png" width="430" height="293" alt="Screenshot of Mutt; click for bigger version" /></a></p>
<p>(Click for higher-resolution version)</p>
<p>If that freaks you out, it may be best to stop reading, move along. Run, don&#8217;t walk.</p>
<h3>Context is useful</h3>
<p>Like, I suspect, most Mutt users, I don&#8217;t really know most of its features. It&#8217;s pretty complicated to configure. When other Mutt users glance at my email they quite commonly ask, &#8220;how did you split the window like that!?&#8221; I didn&#8217;t, it&#8217;s not split, it&#8217;s just a different layout of message window. Here&#8217;s how:</p>
<blockquote><p>
set <a href="http://mutt-ng.berlios.de/manual/pager-index-lines.html">pager_index_lines</a>=5
</p></blockquote>
<p>Just handy for being able to see a bit of the context of where the current post is in regards to the rest of the thread.</p>
<h3>Threading matters</h3>
<p>Once a thread has gone bad, it&#8217;s usually going to stay bad. The most useful tricks involve operating on whole threads at once, so you don&#8217;t have to tediously click something on every email. So while it might not seem like the most annoying thing at first, people not threading properly becomes one of the more annoying things later as it slows down whatever you are trying to do on the thread.</p>
<p>Sort your folders by thread:</p>
<blockquote><p>
set <a href="http://mutt-ng.berlios.de/manual/sort.html">sort</a>=threads
</p></blockquote>
<p>Unfortunately Mutt doesn&#8217;t seem to have a feature to break a thread when the subject header changes, so you might instead prefer to sort by subject. That had too many false positives for me though, even with sort_re.</p>
<h3>Get rid of a whole thread</h3>
<p>If you&#8217;re looking at the start of a thread, and it&#8217;s uninteresting, and you can see all of the thread below it, chances are that it&#8217;s all going to be uninteresting. You can mark it all read with <code><strong>ctrl-r</strong></code>. I prefer to see the whole thread on the screen before doing that, because there&#8217;s some chance that someone might change the subject line into something that becomes interesting.</p>
<p>I find myself reading some lists mostly with <code><strong>ctrl-r</strong></code> without even looking at the content of the posts. For example, a thread that starts with &#8220;Mandriva v Windows&#8221; isn&#8217;t very likely to contain anything except trolling and counter-trolling (If you are unaware of what Mandriva is, you are reading the wrong blog post and only need know that it is a brand name for a popular USB personal massager product).</p>
<p>The risk is that someone will go off at a tangent and post something that is actually interesting, without changing the subject. I&#8217;m willing to take the risk; they should have changed the subject IMHO. And anyway, you still have the mail, it&#8217;s only been marked as read.</p>
<h3>Deal with subthreads</h3>
<p>If you can see that the subject of a thread has changed or there&#8217;s some other reason why you might want to treat every message below the current one differently, then you can operate on subthreads.</p>
<p>The most simple thing is to break the subthread off into a new thread of its own. <code><strong>#</strong></code> will do that. You can then treat it differently, use the thread commands on it in isolation. That&#8217;s how I usually do it because if this happened then it means that the content of the subthread is very different to the rest of the thread, to me.</p>
<p>If you want to keep it as part of the same thread, you can mark the subthread read with <code><strong>esc-r</strong></code> (or <code><strong>alt-r</strong></code>).</p>
<p>Also useful for when someone decides that the right way to start a new email is to just press reply on some other random email.</p>
<h3>Tagging</h3>
<p>Occasionally a bunch of posts are the same sort of thing but they&#8217;re not in a thread. If you can find something about them that&#8217;s common then you can tag them based on that, with <code><strong>T</strong></code>. e.g. <code><strong>T</strong></code> followed by <strong><strong>~h @luser.example.com</strong></strong> tags every email that has &#8220;@luser.example.com&#8221; in its headers.</p>
<p>If you can&#8217;t think of anything to match on then at the very least, just hitting <code><strong>t</strong></code> on each of the posts will tag it.</p>
<p>Once tagged, you&#8217;ll find that many existing Mutt commands that operate on a single email will work on a bunch of tagged emails as well, by prefixing the command with <code><strong>;</strong></code>. So, if you imagine you&#8217;d tagged the above emails and wanted to mark them read, the next thing you&#8217;d do would be <code><strong>;N</strong></code>.</p>
<h3>Rejoin broken threading</h3>
<p>Some people continue to use broken email clients that don&#8217;t do threading properly. All of their posts appear in a new thread. You can easily rejoin errant posts into an existing thread by tagging them, moving to the post they should be replies of, and using the <code><strong>&#038;</strong></code> command. It may seem like a lot of hassle, but the benefit is that every reply to that one will then be in the right place too.</p>
<p>Useful for those pointless flamewars that just won&#8217;t die. &#8220;Oh look it&#8217;s that thread again, I&#8217;ll just mark it read again.&#8221;</p>
<h3>More info</h3>
<p>That&#8217;s about all I can think of in terms of the simple stuff I do every day when reading email. I hope it helped some newcomers to Mutt. There&#8217;s a lot of great tips in the documentation but it can seem a bit impenetrable at first:</p>
<ul>
<li><a href="http://www.mutt.org/doc/manual/manual-2.html#ss2.3">Reading Mail &#8211; the Index and Pager</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://strugglers.net/~andy/blog/2010/03/14/coping-with-busy-mailing-lists-with-mutt/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mushrooms stuffed with sun-dried tomatoes, Dauphinoise potatoes and aubergine rolls with pesto, tiramisu</title>
		<link>http://strugglers.net/~andy/blog/2010/02/16/mushrooms-stuffed-with-sun/</link>
		<comments>http://strugglers.net/~andy/blog/2010/02/16/mushrooms-stuffed-with-sun/#comments</comments>
		<pubDate>Tue, 16 Feb 2010 23:27:09 +0000</pubDate>
		<dc:creator>Andy</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://strugglers.net/~andy/blog/?p=472</guid>
		<description><![CDATA[On Sunday I&#8217;d offered to cook a three course meal that&#8217;s a bit different from what we usually eat.  I virtually never cook and when I do it&#8217;s always just something quick.  I don&#8217;t enjoy cooking, but I thought I&#8217;d give it a go anyway.  Although these recipes were very simple, by [...]]]></description>
			<content:encoded><![CDATA[<p>On Sunday I&#8217;d offered to cook a three course meal that&#8217;s a bit different from what we usually eat.  I virtually never cook and when I do it&#8217;s always just something quick.  I don&#8217;t enjoy cooking, but I thought I&#8217;d give it a go anyway.  Although these recipes were very simple, by the time the day came I was feeling quite nervous.</p>
<h3>Ingredients</h3>
<p>I used the following recipes as a basis, reducing to serve 2:</p>
<ul>
<li><a href="http://www.epicurious.com/recipes/food/views/Mushrooms-Stuffed-with-Sun-Dried-Tomatoes-11824">Mushrooms stuffed with sun-dried tomatoes</a></li>
<li><a href="http://www.channel4.com/food/recipes/vegetarian/dauphinoise-potatoes-recipe_p_1.html">Dauphinoise potatoes</a></li>
<li><a href="http://www.channel4.com/food/recipes/vegetarian/aubergine-rolls-with-pesto-recipe_p_1.html">Aubergine rolls with pesto</a></li>
<li><a href="http://www.channel4.com/food/recipes/chefs/gordon-ramsay/tiramisu-recipe_p_1.html">Tiramisu</a></li>
</ul>
<p>I couldn&#8217;t find aubergines anywhere (tried 3 big supermarkets) so had to settle for baby aubergines which of course weren&#8217;t big enough to wrap anything in.</p>
<h3>Method</h3>
<h4>Mushrooms stuffed with sun-dried tomatoes</h4>
<p class="balignright" style="padding: 8px;"><a href="http://gallery.strugglers.net/v/Andy/Cooking-Adventure-2010-02/P1030176.JPG.html"><img src="http://gallery.strugglers.net/d/19527-2/P1030176.JPG" width="150" height="113" /></a></p>
<ul>
<li>Preheat oven to 200C.</li>
<li>Soak about 8g sun-dried tomatoes in a small bowl of hot water, covered for 5 minutes.</li>
<li>Reserve a tablespoon of the liquid, drain the rest off and chop the tomatoes finely.</li>
<li>Chop off the mushroom stems and chop them finely.</li>
<li>Finely chop 1/8th cup of shallots.</li>
<li>Finely chop a clove of garlic.</li>
<li>Lightly beat a large egg yolk.</li>
<li>Mince 1/8th cup of parsley leaves.</li>
<li>Crumble 1/4 teaspoon of basil.</li>
<li>Heat 2 tablespoons of olive oil in a frying pan over moderate heat until hot but not steaming.  Add the mushroom stems and shallots, stirring until shallots are softened.</li>
<li>In a bowl stir together the mushroom stems, shallots, 1/6th cup bread crumbs, sun-dried tomatoes, the reserved liquid, the egg yolk, parsely, basil and garlic.  Add salt to taste.  Mound into the mushroom caps.</li>
<li>Brush the mushroom caps with sun-dried tomato oil.</li>
<li>Arrange the cups in a lightly greased shallow baking dish.</li>
<li>Sprinkle the caps with 2 tablespoons of grated parmesan.</li>
<li>Bake in the middle of the oven for 15 minutes.</li>
</ul>
<h4>Aubergine rolls with pesto</h4>
<p class="balignright" style="padding: 8px;"><a href="http://gallery.strugglers.net/v/Andy/Cooking-Adventure-2010-02/P1030178.JPG.html"><img src="http://gallery.strugglers.net/d/19533-2/P1030178.JPG" width="150" height="113" /></a></p>
<ul>
<li>Preheat oven to 180C.</li>
<li>Cut 1 small carrot into matchsticks.</li>
<li>Deseed and slice half a red pepper.</li>
<li>Trim 8 asparagus spears.</li>
<li>Chop half a clove of garlic.</li>
<li>Finely grate 40g parmesan.</li>
<li>Top and tail 2 aubergines.  Slice aubergines lengthways into about 8 4-5mm thick strips.  Add salt and pepper, brush with extra-virgin olive oil and set aside for 5 minutes.  Since I only had baby aubergines I could only slice them into small thin chips at this point.</li>
<li>Brush a pan with olive oil, place over high heat, cook aubergines for 2 minutes each side.  Set aside.</li>
<li>Blanch vegetables in boiling water:
<ul>
<li>Carrots: 3 minutes</li>
<li>Pepper: 2 minutes</li>
<li>Asparagus: 1 minute</li>
</ul>
<p>Drain, pat dry and set aside.</li>
<li>Coarsely blend the garlic, 50g of drained sun-dried tomatoes and 1 tablespoon of pine nuts.</li>
<li>Add 10g fresh basil, the parmesan, and 65ml extra-virgin olive oil and blend again.  Season and stir in 1 tablespoon of double cream.</li>
<li>Lay the vegetables at the end of each aubergine slice, roll up to secure and place in a large baking dish.  Drizzle with extra-virgin olive oil and bake for 6-7 minutes or until hot.</li>
<li>Serve with pesto, garnish with lemon and salad leaves.</li>
</ul>
<h4>Dauphinoise potatoes</h4>
<ul>
<li>Preheat oven to 190C.</li>
<li>Thinly slice half an onion.</li>
<li>Slice 500g of King Edward potatoes thinly with a mandolin.</li>
<li>Grease up a shallow baking dish with butter (I used Pure soy spread).</li>
<li>Mix ~140ml double cream and ~40ml milk.</li>
<li>Layer the potatoes and onions evenly in the dish.  Pour the cream and milk over, dot over with butter and cover the dish with foil.</li>
<li>Bake for one hour.</li>
<li>Discard the foil and bake for a further 15-20 minutes or until potatoes are golden.</li>
</ul>
<h4>Tiramisu</h4>
<p class="balignright" style="padding: 8px;"><a href="http://gallery.strugglers.net/v/Andy/Cooking-Adventure-2010-02/P1030180.JPG.html"><img src="http://gallery.strugglers.net/d/19538-2/P1030180.JPG" width="150" height="113" /></a></p>
<ul>
<li>Sift ~22g icing sugar into ~112g mascarpone.  Add 1/2 teaspoon of vanilla extract and 2 tablespoons of Tia Maria.</li>
<li>In a separate bowl, whisk ~85ml of double cream until soft peaks form.</li>
<li>Mix the cream and mascarpone together and refrigerate.</li>
<li>Break some sponge fingers to size and briefly dip them in cold, strong coffee.</li>
<li>Place the sponge fingers in the bottom of serving glasses and spoon mascarpone cream over.</li>
<li>Grate chocolate on top before serving.</li>
</ul>
<h3>Conclusion</h3>
<p>We were pretty pleased with how it turned out, very yummy!  Things I&#8217;d change:</p>
<p>Presentation could have been better.  The vegetables on a bed of aubergines should have been aubergine wraps, but I couldn&#8217;t find big enough aubergines.  Easy enough to fix.  The Dauphinoise potatoes would have looked a lot better if they&#8217;d been nice equal sizes and shapes but I only had a grater to slice them with and it was the first time I&#8217;d tried.  I might have done better with a proper mandolin, and/or more practice.</p>
<p>The Dauphinoise potatoes were rather too creamy for my liking, but Jenny really liked them.  Maybe not so much a change needed as simply smaller portions for me; not a huge fan of potatoes.</p>
<p>There was probably a bit too much parmesan in everything, especially the stuffing for the mushrooms.  That could have done with being toned down a bit.</p>
<p>No complaints about the Tiramisu!</p>
]]></content:encoded>
			<wfw:commentRss>http://strugglers.net/~andy/blog/2010/02/16/mushrooms-stuffed-with-sun/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>OpenLDAP and md5crypt</title>
		<link>http://strugglers.net/~andy/blog/2010/01/23/openldap-and-md5crypt/</link>
		<comments>http://strugglers.net/~andy/blog/2010/01/23/openldap-and-md5crypt/#comments</comments>
		<pubDate>Sat, 23 Jan 2010 03:43:14 +0000</pubDate>
		<dc:creator>Andy</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://strugglers.net/~andy/blog/?p=463</guid>
		<description><![CDATA[I&#8217;ve got some machines which authenticate their local users against OpenLDAP, and I wanted to reset some passwords from a Perl script.
First I tried just calling modify from Net::LDAP.  That worked but just set the new password as plain text.  My passwords appear to be &#8220;md5crypt&#8221;, and normally look like this:

{CRYPT}$1$fywXcrPC$Uakrx8POGBf1WM9l6mkG6/

I could come [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve got some machines which authenticate their local users against <a href="http://www.openldap.org/">OpenLDAP</a>, and I wanted to reset some passwords from a Perl script.</p>
<p>First I tried just calling <tt>modify</tt> from <tt><a href="http://search.cpan.org/~gbarr/perl-ldap-0.39/lib/Net/LDAP.pod">Net::LDAP</a></tt>.  That worked but just set the new password as plain text.  My passwords appear to be &#8220;md5crypt&#8221;, and normally look like this:</p>
<pre class="code">
{CRYPT}$1$fywXcrPC$Uakrx8POGBf1WM9l6mkG6/
</pre>
<p>I could come up with some code to create the correct hash on the machine where I was running the Perl script, but I really wanted the <abbr title="Lightweight Directory Access Protocol">LDAP</abbr> server to do it for me, for consistency.</p>
<p>A little bit of searching revealed <tt><a href="http://search.cpan.org/~gbarr/perl-ldap-0.39/lib/Net/LDAP/Extension/SetPassword.pm">Net::LDAP::Extension::SetPassword</a></tt>, so I gave that a go.  Well, that was progress, but it set <abbr title="Message-Digest 5"><a href="http://en.wikipedia.org/wiki/MD5">MD5</a></abbr> passwords.  They look like this:</p>
<pre class="code">
{MD5}13dmpYRmooMYt50wdZBpSQ==
</pre>
<p>Why did it just decide to use MD5?  <a href="http://www.openldap.org/faq/index.cgi?file=906">The answer&#8217;s in the OpenLDAP FAQ</a>.  <tt>password-hash</tt> was indeed set to <tt>{md5}</tt> on the server.</p>
<p>Right, OK, so set <tt>password-hash</tt> to <tt>{md5crypt}</tt> then?  No!  It does not accept that value.  It <em>does</em> accept <tt>{crypt}</tt>, but that ends up like:</p>
<pre class="code">
{CRYPT}Q.nfbCdTMBuGU
</pre>
<p>It seems to have the right hash type (<tt>{CRYPT}</tt>) but it&#8217;s much shorter.  It&#8217;s the <abbr title="Portable Operating System Interface for Unix"><a href="http://en.wikipedia.org/wiki/POSIX">POSIX</a></abbr> <tt><a href="http://en.wikipedia.org/wiki/Crypt_(Unix)#Library_Function">crypt(3)</a></tt> based on <abbr title="Data Encryption Standard"><a href="http://en.wikipedia.org/wiki/Data_Encryption_Standard">DES</a></abbr>.  Not quite what I wanted.</p>
<p>The eventual answer was <a href="http://www.openldap.org/lists/openldap-software/200207/msg00213.html">found in the archives of the openldap-software mailing list</a> from almost 8 years ago!  So once <b>slapd.conf</b> contained:</p>
<pre class="code">
password-hash  {CRYPT}
password-crypt-salt-format "$1$%.8s"
</pre>
<p>the correct password hash was generated.</p>
<p>How did I know about the &#8220;<tt>.8</tt>&#8221; bit?  In an md5crypt hash, the characters between the <tt>$1$</tt> and the next <tt>$</tt> are the salt, and there&#8217;s 8 of them, so that&#8217;s why <tt>.8s</tt>.</p>
]]></content:encoded>
			<wfw:commentRss>http://strugglers.net/~andy/blog/2010/01/23/openldap-and-md5crypt/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Linux software RAID hot swap disk replacement</title>
		<link>http://strugglers.net/~andy/blog/2010/01/17/linux-software-raid-hot-swap-disk-replacement/</link>
		<comments>http://strugglers.net/~andy/blog/2010/01/17/linux-software-raid-hot-swap-disk-replacement/#comments</comments>
		<pubDate>Sun, 17 Jan 2010 12:06:04 +0000</pubDate>
		<dc:creator>Andy</dc:creator>
				<category><![CDATA[Business]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://strugglers.net/~andy/blog/?p=455</guid>
		<description><![CDATA[One of BitFolk&#8217;s servers in the US has had first one and then two dead disks for quite some time.  It has a 4 disk software RAID-10, so by pure luck it was still running.  Obviously as soon as a disk breaks you really should replace it, preferably with a hot spare.  [...]]]></description>
			<content:encoded><![CDATA[<p>One of <a href="http://bitfolk.com/">BitFolk&#8217;s</a> servers in the US has had first one and then two dead disks for quite some time.  It has a 4 disk software <abbr title="Redundant Array of Inexpensive/Independent Disks">RAID</abbr>-10, so by pure luck it was still running.  Obviously as soon as a disk breaks you really should replace it, preferably with a hot spare.  I was very lucky that the second disk failure wasn&#8217;t from the same half of the RAID-10 (resulting in downtime and restore from backup).  There&#8217;s no customer data or customer-facing services on this machine though, so I let it slide for far too long.</p>
<p>Yesterday morning <a href="http://cernio.com/Members/graham">Graham</a> was visiting the datacenter and kindly agreed to replace the disks for me.  As it happens I don&#8217;t have that much experience of software RAID since the production machines I&#8217;ve worked on tend to have hardware RAID and the home ones tend not to be hot swap.  It didn&#8217;t go entirely smoothly, but I think it was my fault.</p>
<p>The server chassis doesn&#8217;t support drive identification (e.g. by turning a light on) so I had to generate some disk activity so that Graham could see which drive lights weren&#8217;t blinking.  It was easy enough for him to spot that slots 0 and 1 were still blinking away with slots 2 and 3 dead.  I checked <b>/proc/mdstat</b> to ensure that those disks weren&#8217;t still present in any of the arrays.  If they had been then I would have done:</p>
<pre class="code">
$ sudo mdadm --fail /dev/mdX /dev/sdbX
</pre>
<p>to remove each one.</p>
<p>They weren&#8217;t present, so I gave Graham the go-ahead to pull the hot swap drive trays out.</p>
<p>At first the server didn&#8217;t notice anything.  I thought this was bad as I would like it to notice!  This was confirmed to be bad when all disk IO blocked and the load went through the roof.</p>
<p>I think what I had forgotten to do was to remove the devices from the SCSI subsystem as <a href="http://www.anchor.com.au/hosting/support/Linux_Software_RAID_Repair">described in this article</a>.  So for me, it would have been something like:</p>
<pre class="code">
$ for disk in sd{a,b,c,d}; do echo -n "$disk: "; ls -d /sys/block/$disk/device/scsi_device*; done
sda: /sys/block/sda/device/scsi_device:0:0:0:0
sdb: /sys/block/sdb/device/scsi_device:0:0:1:0
sdc: /sys/block/sdc/device/scsi_device:1:0:0:0
sdd: /sys/block/sdd/device/scsi_device:1:0:1:0
</pre>
<p>From <b>/proc/mdstat</b> I knew it was <b>sdb</b> and <b>sdd</b> that were broken.  I think I should have done:</p>
<pre class="code">
$ sudo sh -c 'echo "scsi remove-single-device" 0 0 1 0 > /proc/scsi/scsi'
$ sudo sh -c 'echo "scsi remove-single-device" 1 0 1 0 > /proc/scsi/scsi'
</pre>
<p>Anyway, at the time what I had was a largely unresponsive server.  I used <a href="http://en.wikipedia.org/wiki/Magic_sysrq">Magic Sysrq</a> to sync, mount filesystems read-only and then reboot.  In <a href="http://cernio.com/">Cernio&#8217;s</a> console this would normally be &#8220;<strong>~b</strong>&#8221; to send a break, but Xen uses &#8220;<strong>ctrl-o</strong>&#8220;.  So that was <strong>ctrl-o s</strong> to sync, <strong>ctrl-o u</strong> to remount read-only and then <strong>ctrl-o b</strong> to reboot the system.</p>
<p>Graham had by then taken the dead disks out of the caddies and replaced with new, re-inserted them and powered the server back on.</p>
<p>Happily it did come back up fine, I then had to set about adding the new disks to the arrays.</p>
<p>I&#8217;d already been forewarned that the new disks had 488397168 sectors whereas the existing ones had 490234752 &#8212; both described as 250GB of course!  A difference of some 890MiB, despite them both being from the same manufacturer, from the same range even.  I didn&#8217;t bother adding a swap partition on the two new disks which made them just about big enough for everything else.</p>
<pre class="code">
$ sudo mdadm --add /dev/md1 /dev/sdb1
mdadm: Cannot open /dev/sdb1: Device or resource busy
</pre>
<p>Oh dear!</p>
<p>After lengthy googling, <a href="http://m0dlx.com/blog/mdadm___dm_multipath___Device_or_resource_busy.html">this article</a> gave me a clue.</p>
<pre class="code">
$ sudo mulitpath -l
SATA_WDC_WD2500SD-01WD-WCAL72844661dm-1 ATA,WDC WD2500SD-01K
[size=233G][features=0][hwhandler=0]
\_ round-robin 0 [prio=0][active]
 \_ 1:0:1:0 sdd 8:48  [active][undef]
SATA_WDC_WD2500SD-01WD-WCAL72802716dm-0 ATA,WDC WD2500SD-01K
[size=233G][features=0][hwhandler=0]
\_ round-robin 0 [prio=0][active]
 \_ 0:0:1:0 sdb 8:16  [active][undef]
</pre>
<p>There&#8217;s my disks!</p>
<p>Stopping <b>multipath</b> daemon didn&#8217;t help.  Running <b>multipath -F</b> did help.</p>
<p>The usual</p>
<pre class="code">
$ sudo mdadm --add /dev/md1 /dev/sdb1
$ sudo mdadm --add /dev/md1 /dev/sdd1
$ sudo mdadm --add /dev/md3 /dev/sdb3
$ sudo mdadm --add /dev/md3 /dev/sdd3
$ sudo mdadm --add /dev/md5 /dev/sdb5
$ sudo mdadm --add /dev/md5 /dev/sdd5
</pre>
<p>worked fine after that.</p>
<p>I hope that was useful to someone.  I&#8217;ll be practising it some more on some spare hardware here to see if the fiddling with <b>/proc/scsi/scsi</b> really does work.</p>
<p><strong>Update</strong>:</p>
<p><a href="http://m0dlx.com/blog/">Dominic</a> (author of the linked article about dm-multipath) says:</p>
<blockquote><p>
I think there&#8217;s also a &#8220;remove&#8221; or &#8220;delete&#8221; file you can echo to in the /sys device directory, bit more friendly than talking to /proc/scsi/scsi.
</p></blockquote>
<p>and provides this snippet for <b>multipath.conf</b> which should disable multipath:</p>
<pre class="code">
# Blacklist all devices by default. Remove this to enable multipathing
# on the default devices.
blacklist {
        devnode "*"
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://strugglers.net/~andy/blog/2010/01/17/linux-software-raid-hot-swap-disk-replacement/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>THING!</title>
		<link>http://strugglers.net/~andy/blog/2010/01/05/thing/</link>
		<comments>http://strugglers.net/~andy/blog/2010/01/05/thing/#comments</comments>
		<pubDate>Tue, 05 Jan 2010 00:12:50 +0000</pubDate>
		<dc:creator>Andy</dc:creator>
				<category><![CDATA[Personal]]></category>

		<guid isPermaLink="false">http://strugglers.net/~andy/blog/?p=447</guid>
		<description><![CDATA[I always find it adorable when Jenny talks to me in her sleep, especially when my responses obviously provoke a reaction without waking her up.
Out of nowhere just now:

Her: Erm. Erm. If you&#8217;ve separated all the wood stuff how are you going to separate the rest?
Me: What wood stuff?
Her: From my bit.
(voice manages to convey [...]]]></description>
			<content:encoded><![CDATA[<p>I always find it adorable when Jenny talks to me in her sleep, especially when my responses obviously provoke a reaction without waking her up.</p>
<p>Out of nowhere just now:</p>
<blockquote><p>
Her: Erm. Erm. If you&#8217;ve separated all the wood stuff how are you going to separate the rest?</p>
<p>Me: What wood stuff?</p>
<p>Her: From my bit.</p>
<p><em>(voice manages to convey mild irritation at my lack of understanding)</em></p>
<p>Me: Your bit of what?</p>
<p>Her: <strong>Thing!</strong></p>
<p><em>(Sleep-Jenny clearly losing patience)</em></p>
<p>Me: Okay then.  We&#8217;ll work it out.</p>
<p>Her: <strong>Good.</strong></p>
<p><em>(the world has been set to rights)</em>
</p></blockquote>
<p>In the morning I shall endeavour to find out what her bit is and what apart from wood needs to be separated from it.</p>
]]></content:encoded>
			<wfw:commentRss>http://strugglers.net/~andy/blog/2010/01/05/thing/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Feltham Airparcs leisure centre FAIL</title>
		<link>http://strugglers.net/~andy/blog/2010/01/04/feltham-airparcs-leisure-centre-fail/</link>
		<comments>http://strugglers.net/~andy/blog/2010/01/04/feltham-airparcs-leisure-centre-fail/#comments</comments>
		<pubDate>Mon, 04 Jan 2010 17:50:01 +0000</pubDate>
		<dc:creator>Andy</dc:creator>
				<category><![CDATA[FAIL]]></category>
		<category><![CDATA[Rant]]></category>

		<guid isPermaLink="false">http://strugglers.net/~andy/blog/?p=432</guid>
		<description><![CDATA[Feltham Airparcs leisure centre has for the last 2 weeks &#8212; and ongoing &#8212; closed at 4pm, instead of 10pm, because the emergency lighting doesn&#8217;t work.
The actual lighting works fine, it&#8217;s just that if the lighting did fail then there&#8217;d be no emergency lights directing the shallow end of the gene pool to safety.
So the [...]]]></description>
			<content:encoded><![CDATA[<p>Feltham Airparcs leisure centre has for the last 2 weeks &#8212; and ongoing &#8212; closed at 4pm, instead of 10pm, because the emergency lighting doesn&#8217;t work.</p>
<p>The actual lighting works fine, it&#8217;s just that if the lighting <em>did</em> fail then there&#8217;d be no emergency lights directing the shallow end of the gene pool to safety.</p>
<p>So the staff close the place up as soon as it starts to get a bit dusky out.</p>
]]></content:encoded>
			<wfw:commentRss>http://strugglers.net/~andy/blog/2010/01/04/feltham-airparcs-leisure-centre-fail/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Those Google Chrome Ads</title>
		<link>http://strugglers.net/~andy/blog/2009/12/27/those-google-chrome-ads/</link>
		<comments>http://strugglers.net/~andy/blog/2009/12/27/those-google-chrome-ads/#comments</comments>
		<pubDate>Sun, 27 Dec 2009 07:31:29 +0000</pubDate>
		<dc:creator>Andy</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://strugglers.net/~andy/blog/?p=421</guid>
		<description><![CDATA[Yesterday I happened to be waiting on a tube platform with a non-technical person, and we were opposite one of those new Google Chrome ads, as pictured here.

I&#8217;ve seen a few people comment that they didn&#8217;t think that a non-technical person would understand what they were all about, so I took the opportunity to ask [...]]]></description>
			<content:encoded><![CDATA[<p>Yesterday I happened to be waiting on a tube platform with a non-technical person, and we were opposite one of those new <a href="http://www.google.co.uk/chrome">Google Chrome</a> ads, as pictured here.</p>
<p><a href="http://gallery.strugglers.net/v/Andy/Misc/p1030018.jpg.html"><img src="http://gallery.strugglers.net/d/19053-2/p1030018.jpg" width="150" height="113" class="balignright" /></a></p>
<p>I&#8217;ve seen a few people comment that they didn&#8217;t think that a non-technical person would understand what they were all about, so I took the opportunity to ask my friend about it.</p>
<p>&#8220;See that ad over there?  What do you think it&#8217;s for?&#8221;</p>
<p>&#8220;It looks like it&#8217;s for a search thing.  A new kind of web search thing.  That&#8217;s a big list of related things to what they searched for&#8221;</p>
<p>&#8220;What do you think Google Chrome is then?&#8221;</p>
<p>&#8220;Well it says on it, a new browser.  That&#8217;s what you use to search isn&#8217;t it?&#8221;</p>
<p>&#8220;What other browsers are there then?&#8221;</p>
<p>&#8220;Well there&#8217;s the Yahoo! one, and then there&#8217;s the Google one.&#8221;</p>
<p>So to the extent that she even noticed the ad, she assumed it was just something to do with Google&#8217;s search engine, because of the search implications and prior meaning of the brand &#8220;Google&#8221;.</p>
<p>I don&#8217;t think this proves anything, but it was interesting hearing another point of view.</p>
]]></content:encoded>
			<wfw:commentRss>http://strugglers.net/~andy/blog/2009/12/27/those-google-chrome-ads/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Business proposition</title>
		<link>http://strugglers.net/~andy/blog/2009/12/22/business-proposition/</link>
		<comments>http://strugglers.net/~andy/blog/2009/12/22/business-proposition/#comments</comments>
		<pubDate>Tue, 22 Dec 2009 13:16:45 +0000</pubDate>
		<dc:creator>Andy</dc:creator>
				<category><![CDATA[Crazy ideas]]></category>

		<guid isPermaLink="false">http://strugglers.net/~andy/blog/?p=416</guid>
		<description><![CDATA[I&#8217;m wondering if you could take all the &#8220;fun&#8221; manual jobs like smashing things with hammers, and contract them out to normally-desk-bound people, who do it for minimum wage (for the task at hand).  So then you have a large work force who individually only do the manual work for a small part of [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m wondering if you could take all the &#8220;fun&#8221; manual jobs like smashing things with hammers, and contract them out to normally-desk-bound people, who do it for minimum wage (for the task at hand).  So then you have a large work force who individually only do the manual work for a small part of their time each (e.g. one day a week/month), maintaining their usual career the rest of the time.</p>
<p>What other kinds of manual labour do people enjoy?  It&#8217;s pretty much just smashing things up for me I think.</p>
]]></content:encoded>
			<wfw:commentRss>http://strugglers.net/~andy/blog/2009/12/22/business-proposition/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>The dark side of Dubai; the dark side of us</title>
		<link>http://strugglers.net/~andy/blog/2009/12/01/the-dark-side-of-dubai-the-dark-side-of-us/</link>
		<comments>http://strugglers.net/~andy/blog/2009/12/01/the-dark-side-of-dubai-the-dark-side-of-us/#comments</comments>
		<pubDate>Tue, 01 Dec 2009 03:22:05 +0000</pubDate>
		<dc:creator>Andy</dc:creator>
				<category><![CDATA[Personal]]></category>
		<category><![CDATA[Rant]]></category>

		<guid isPermaLink="false">http://strugglers.net/~andy/blog/?p=405</guid>
		<description><![CDATA[I saw a link to this article about Dubai on Twitter today.  Like zts, I found it an extremely disturbing read, stopping at many points to read out loud to anyone who would listen.  I recommend that you read it too.
After having read through it, I suppose my first thought is to wonder [...]]]></description>
			<content:encoded><![CDATA[<p>I saw a link to <a href="http://www.independent.co.uk/opinion/commentators/johann-hari/the-dark-side-of-dubai-1664368.html">this article about Dubai</a> <a href="http://twitter.com/zts/status/6213040073">on Twitter today</a>.  Like zts, I found it an extremely disturbing read, stopping at many points to read out loud to anyone who would listen.  I recommend that you read it too.</p>
<p>After having read through it, I suppose my first thought is to wonder why anyone who knows that this sort of thing goes on would ever go there.  Why any rich person from a democratic country would move there to set up home.  Why any Western sporting personalities or pop stars would put their name to Dubai resorts and hotels, to stadiums and their gigs.  <a href="http://www.starpulse.com/news/index.php/2009/02/13/coldplay_s_2_million_dubai_show">Coldplay, Bon Jovi, Justin Timberlake, Shakira, Christina Aguilera and Elton John</a> aren&#8217;t really acts you associate with slavery, after all.</p>
<p>The urge to take the moral high ground and denounce the practice is strong, and rightly so.  Something nags at me though about how much of our society must be built on injustice.  The clothes and food we buy when we&#8217;re being economical, how much of it comes from oppressed workers?  Do we just turn a blind eye all the time?</p>
<p>The people interviewed by Johann Hari in the article either avoid the subject or say they force themselves not to think about it, so a lot of them too are just turning a blind eye.  I like to think that if I knew some product was the result of sweat shop labour (let alone slavery) then I would avoid it, but am I kidding myself?</p>
<p>When we could afford it we shopped at Waitrose/Ocado not just because it tasted better but because it&#8217;s got to be ethically superior, right?  But as soon as we needed to live on a tighter budget this went out of the window and these days we mostly shop at Asda.  Most of the bad publicity for supermarkets in the UK seems to be <a href="http://www.belfasttelegraph.co.uk/business/business-news/vince-cable-big-firms-are-screwing-small-suppliers-14276103.html">reserved</a> <a href="http://www.guardian.co.uk/business/2009/jul/03/tesco-migrant-workers-protest">for</a> <a href="http://www.telegraph.co.uk/news/uknews/2094404/Hugh-Fearnley-Whittingstall-crys-fowl-over-Tescos-chicken-vote.html">Tesco</a> but Asda is even cheaper and I can&#8217;t really believe their practices are that much better.  They have whole cooked chickens for £4, for goodness sake.  I could stop shopping there but then that would be less money to spend on other things which would reduce the quality of my life, so this makes me a massive selfish hypocrite.</p>
<p>Of course none of this is comparable to the blatantly fucked Dubai society; if Asda were taking passports off of Filipino girls and forcing them to sell cheap goods for 19 hours a day for no money then certainly I&#8217;d consider paying more than 5p per 100ml of Pepsi Max at a competing supermarket.</p>
<p>It&#8217;s a bit of a coincidence that we&#8217;re hearing all this about Dubai now though, just as they enter the news for <a href="http://www.guardian.co.uk/business/2009/nov/30/billions-wiped-market-dubai-crisis">allowing their state bank to default massively</a>.  This stuff has been going on for years, right?  The millions of slaves used to build that place.  I confess I never really thought about it before.  The worst I&#8217;d previously heard was about <a href="http://news.bbc.co.uk/1/hi/uk/7234786.stm">their insane laws on drugs</a> which could get you locked up for minuscule traces on the outside of your shoes, or for stuff you bought over the counter in the airport.</p>
<p>We all turned a blind eye for years.</p>
<p>If you read this far and for some reason want to comment then it would be great if your comment was not solely based on what you do to consume more ethically than everyone else on the Internet.</p>
]]></content:encoded>
			<wfw:commentRss>http://strugglers.net/~andy/blog/2009/12/01/the-dark-side-of-dubai-the-dark-side-of-us/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>My root file system doesn&#8217;t show up in &#8220;df&#8221; anymore!</title>
		<link>http://strugglers.net/~andy/blog/2009/11/26/my-root-file-system-doesnt-show-up-in-df-anymore/</link>
		<comments>http://strugglers.net/~andy/blog/2009/11/26/my-root-file-system-doesnt-show-up-in-df-anymore/#comments</comments>
		<pubDate>Thu, 26 Nov 2009 03:20:22 +0000</pubDate>
		<dc:creator>Andy</dc:creator>
				<category><![CDATA[Business]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://strugglers.net/~andy/blog/?p=400</guid>
		<description><![CDATA[Earlier tonight I had a strange bug report from a customer.  Ever since I&#8217;d moved his VPS from one host to another, he&#8217;d stopped being able to see how much disk space he had free.
At first I thought it was simply because when I had moved his VPS I had taken the opportunity to [...]]]></description>
			<content:encoded><![CDATA[<p>Earlier tonight I had a strange bug report from a <a href="http://bitfolk.com/">customer.</a>  Ever since I&#8217;d moved his VPS from one host to another, he&#8217;d stopped being able to see how much disk space he had free.</p>
<p>At first I thought it was simply because when I had moved his <abbr title="Virtual Private Server">VPS</abbr> I had taken the opportunity to reconfigure it to the new way I was setting them up, which meant that his root file system would be mounted from <tt>/dev/xvda</tt> instead of <tt>/dev/xvda1</tt> (or <tt>/dev/sda1</tt>).  That would have accounted for it if his monitoring tool had been doing it by device name, but it turned out that it was more fundamental than that &#8212; neither <strong>mount</strong> nor <strong>df</strong> were showing his root file system at all!</p>
<p>This was highly confusing at first.  <tt>/proc/mounts</tt> looked correct and anyway how does a machine boot if it doesn&#8217;t know where its root file system is?</p>
<p>The answer to that question was a bit of a clue really: the boot loader tells the kernel what device the root file system is on, and in this case it was doing it by <abbr title="Universally Unique Identifier">UUID</abbr>.  The UUID in the boot loader configuration was not the same as the UUID listed in <tt>/etc/fstab</tt>.  I had forgotten to update the customer&#8217;s <tt>/etc/fstab</tt>. <img src='http://strugglers.net/~andy/blog/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> </p>
<p>The machine was able to boot because the boot loader was correctly configured, but then after it had already mounted the root file system it was trying to mount everything in <tt>/etc/fstab</tt> and failing on a line for a UUID that wasn&#8217;t present.  That line then never made it to <tt>/etc/mtab</tt> which is what <strong>mount</strong> and <strong>df</strong> are reading from.</p>
<p>After correcting the <tt>/etc/fstab</tt>, it is fixable without a reboot by just mounting / again over the top of the existing one.  Or you could probably just edit <tt>/etc/mtab</tt>.</p>
]]></content:encoded>
			<wfw:commentRss>http://strugglers.net/~andy/blog/2009/11/26/my-root-file-system-doesnt-show-up-in-df-anymore/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
