<?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>A bit of this, a bit of that &#187; repair</title>
	<atom:link href="http://gael.enix.org/tag/repair/feed/" rel="self" type="application/rss+xml" />
	<link>http://gael.enix.org</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Mon, 24 Aug 2009 17:11:42 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Rebuild a RAID5 array on CentOS 5.2 with mdadm</title>
		<link>http://gael.enix.org/2008/12/08/rebuild-a-raid5-array-on-centos-5-2-with-mdadm/</link>
		<comments>http://gael.enix.org/2008/12/08/rebuild-a-raid5-array-on-centos-5-2-with-mdadm/#comments</comments>
		<pubDate>Mon, 08 Dec 2008 22:24:32 +0000</pubDate>
		<dc:creator>Gael</dc:creator>
				<category><![CDATA[IT]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[raid]]></category>
		<category><![CDATA[repair]]></category>

		<guid isPermaLink="false">http://gael.enix.org/wordpress/?p=14</guid>
		<description><![CDATA[My RAID 5 array on a CentOS 5.2 machine just crashed due to a faulty disk so I had to rebuild the array manually. I first thought it would have been the worse time in my life as I do not like too much messing around with my hardware but finally it went pretty smoothly.
So [...]]]></description>
			<content:encoded><![CDATA[<p>My RAID 5 array on a CentOS 5.2 machine just crashed due to a faulty disk so I had to rebuild the array manually. I first thought it would have been the worse time in my life as I do not like too much messing around with my hardware but finally it went pretty smoothly.<br />
So here is how I did to rebuild the RAID, just follow those steps&#8230;</p>
<p>First of all you have to look at the problem on md2:</p>
<pre>
<pre>[root@bacchus ~]# cat /proc/mdstat</pre>
<pre>Personalities : [raid1] [raid6] [raid5] [raid4]</pre>
<pre>md0 : active raid1 hdb1[1] hda1[0]</pre>
<pre>      152512 blocks [2/2] [UU]</pre>
<pre>md2 : active raid5 sda1[0] sdb1[1]</pre>
<pre>      625137152 blocks level 5, 64k chunk, algorithm 2 [3/2] [UU_]</pre>
<pre>md1 : active raid1 hdb2[1] hda2[0]</pre>
<pre>      117065536 blocks [2/2] [UU]</pre>
</pre>
<p>The faulty device was located on hdc, and on the partition hdc1.  So first of all, you have to recreate the partition with the <code>Linux raid autodetect</code> type and write the changes to this partition:</p>
<pre>[root@bacchus ~]# fdisk /dev/sdc
Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-38913, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-38913, default 38913):
Using default value 38913

Command (m for help): p

Disk /dev/sdc: 320.0 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1               1       38913   312568641   83  Linux

Command (m for help): t
Selected partition 1
Hex code (type L to list codes): fd
Changed system type of partition 1 to fd (Linux raid autodetect)

Command (m for help): p

Disk /dev/sdc: 320.0 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1               1       38913   312568641   fd  Linux raid autodetect
Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
[root@bacchus ~]#</pre>
<p>Once the partition is created, you have to add the partition to the RAID array with the following command line:</p>
<pre>mdadm /dev/md2 -a /dev/sdc1</pre>
<p>Once this is done, you just have to monitor the rebuild from time to time with this command:</p>
<pre>[gael@bacchus ~]$ cat /proc/mdstat
Personalities : [raid1] [raid6] [raid5] [raid4]
md0 : active raid1 hdb1[1] hda1[0]
      152512 blocks [2/2] [UU]

md2 : active raid5 sdc1[3] sda1[0] sdb1[1]
      625137152 blocks level 5, 64k chunk, algorithm 2 [3/2] [UU_]
      [========&gt;............]  recovery = 43.9% (137368104/312568576) finish=85.7min speed=34061K/sec

md1 : active raid1 hdb2[1] hda2[0]
      117065536 blocks [2/2] [UU]

unused devices:</pre>
<p>Et voila!, now you just have to wait for you RAID partition to be rebuilt and then you will be an happy bunny <img src='http://gael.enix.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://gael.enix.org/2008/12/08/rebuild-a-raid5-array-on-centos-5-2-with-mdadm/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
