<?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>Never Use This Font &#187; raid</title>
	<atom:link href="http://neverusethisfont.com/blog/tags/raid/feed/" rel="self" type="application/rss+xml" />
	<link>http://neverusethisfont.com/blog</link>
	<description>Aaron Parecki is the co-founder of Geoloqi.com, and specializes in backend systems development.</description>
	<lastBuildDate>Mon, 11 Jul 2011 22:50:38 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.3</generator>
		<item>
		<title>Another raid5 scare, and how to recover an apparently trashed array</title>
		<link>http://neverusethisfont.com/blog/2008/08/another-raid5-scare-and-how-to-recover-an-apparently-trashed-array/</link>
		<comments>http://neverusethisfont.com/blog/2008/08/another-raid5-scare-and-how-to-recover-an-apparently-trashed-array/#comments</comments>
		<pubDate>Mon, 18 Aug 2008 17:52:12 +0000</pubDate>
		<dc:creator>aaron</dc:creator>
				<category><![CDATA[Hardware]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Troubleshooting]]></category>
		<category><![CDATA[mdadm]]></category>
		<category><![CDATA[raid]]></category>
		<category><![CDATA[raid5]]></category>

		<guid isPermaLink="false">http://blog.neverusethisfont.com/2008/08/another-raid5-scare-and-how-to-recover-an-apparently-trashed-array/</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<p>This morning after waking up to lots of thunder and lightning, I got a text message saying my raid5 array had failed. Only this time, 2 of the 3 drives were missing. Since both of those drives were actually mounted via a vblade share (on a different physical machine), I assumed that the other server had freaked out during a power surge. I quickly rebooted the machine to bring back the vblade shares, but then the trouble started.</p>
<p>At some point, the array was &#8220;started&#8221; but had two faulty drives. I tried &#8211;remove and &#8211;add to remove and re-add the &#8220;faulty&#8221; drives. This had the effect of bringing the array back &#8220;online&#8221; with all the drives as spares. I removed the drives again, and tried the trick I used last time:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">mdadm <span style="color: #660033;">--assemble</span> <span style="color: #660033;">-f</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>md0 <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>sda2 <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>etherd<span style="color: #000000; font-weight: bold;">/</span>e4.1 <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>etherd<span style="color: #000000; font-weight: bold;">/</span>e4.2</pre></div></div>

<p>However, this also didn&#8217;t work. It showed the array with /dev/sda2 and /dev/etherd/e4.2 as spares, and e4.1 was nowhere to be seen. At this point I was a little more than worried that I had done something to trash the array. That&#8217;s when a google search led me to this handy command:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">mdadm <span style="color: #660033;">-E</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>sda2</pre></div></div>

<p>This prints out the superblock information that is present on the hard drive. This told me that the e4.2 drive had not been damaged, since I was able to see information there. Also, the UUIDs on all three drives still matched. However, the bottom section of the report differed on all the drives.</p>
<p>A few google searches later, and I came across this:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">mdadm <span style="color: #660033;">--create</span> <span style="color: #660033;">--assume-clean</span> <span style="color: #660033;">--level</span>=<span style="color: #000000;">5</span> <span style="color: #660033;">--raid-devices</span>=<span style="color: #000000;">3</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>md0 <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>sda2 <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>etherd<span style="color: #000000; font-weight: bold;">/</span>e4.2 <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>etherd<span style="color: #000000; font-weight: bold;">/</span>e4.1</pre></div></div>

<p>Using the &#8211;assume-clean flag tells mdadm not to write any data to the drives, or to start initializing the array. However, what I didn&#8217;t realize was that it would reset the UUIDs. That command brought the array back online, at least according to /proc/mdstat, but when I tried to mount it, it couldn&#8217;t figure out the filesystem.</p>
<p>That&#8217;s when I realized that the *order* in which you specify the drives to the &#8211;create command actually matters. I re-ran the command like this:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">mdadm <span style="color: #660033;">--create</span> <span style="color: #660033;">--assume-clean</span> <span style="color: #660033;">--level</span>=<span style="color: #000000;">5</span> <span style="color: #660033;">--raid-devices</span>=<span style="color: #000000;">3</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>md0 <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>sda2 <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>etherd<span style="color: #000000; font-weight: bold;">/</span>e4.1 <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>etherd<span style="color: #000000; font-weight: bold;">/</span>e4.2</pre></div></div>

<p>The array came back online, and I was able to mount it!</p>
<p>So while RAID 5 protects against a single hard drive failing, it does not protect against me running stupid commands on the array. I&#8217;m going to have to start backing up my raid arrays onto other drives&#8230;</p>
<p><strong>Useful Links</strong></p>
<ul>
<li><a href="http://ubuntuforums.org/archive/index.php/t-410136.html">http://ubuntuforums.org/archive/index.php/t-410136.html</a></li>
<li><a href="http://www.linuxdevcenter.com/pub/a/linux/2002/12/05/RAID.html?page=2">http://www.linuxdevcenter.com/pub/a/linux/2002/12/05/RAID.html?page=2</a></li>
<li><a href="http://www.amazon.com/Managing-RAID-Linux-Derek-Vadala/dp/1565927303/ref=pd_bbs_sr_1?ie=UTF8&amp;s=books&amp;qid=1219078238&amp;sr=8-1">Managing RAID on Linux (Amazon.com)</a></li>
<li><a href="http://episteme.arstechnica.com/eve/forums/a/tpc/f/96509133/m/697004072931">http://episteme.arstechnica.com/eve/forums/a/tpc/f/96509133/m/697004072931</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://neverusethisfont.com/blog/2008/08/another-raid5-scare-and-how-to-recover-an-apparently-trashed-array/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

