<?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>h3x.no &#187; mdadm</title>
	<atom:link href="http://h3x.no/tag/mdadm/feed" rel="self" type="application/rss+xml" />
	<link>http://h3x.no</link>
	<description>Tor Henning Ueland`s thoughts about technology and other stuff</description>
	<lastBuildDate>Wed, 25 Aug 2010 21:22:42 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Howto: Increase disk space in a mdadm raid</title>
		<link>http://h3x.no/2010/03/02/howto-increase-disk-space-in-a-mdadm-raid</link>
		<comments>http://h3x.no/2010/03/02/howto-increase-disk-space-in-a-mdadm-raid#comments</comments>
		<pubDate>Tue, 02 Mar 2010 18:35:28 +0000</pubDate>
		<dc:creator>Tor Henning Ueland</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[mdadm]]></category>
		<category><![CDATA[raid]]></category>

		<guid isPermaLink="false">http://h3x.no/?p=288</guid>
		<description><![CDATA[I currently have a Ubuntu Linux server running two mdadm RAID`s. One of the RAID sets is set up using 6 x 500 GB SATA drives. Now i have purchased 6 x 1500 GB SATA drives that will replace the old disks, but the challenge is to increase the RAID and filesystem without loosing any [...]]]></description>
			<content:encoded><![CDATA[<p>I currently have a Ubuntu Linux server running two mdadm RAID`s. One of the RAID sets is set up using 6 x 500 GB SATA drives. Now i have purchased 6 x 1500 GB SATA drives that will replace the old disks, but the challenge is to increase the RAID and filesystem without loosing any data or having downtime. (Note: not having downtime is possible since i use a system that supports hot swapping of drives)</p>
<p>In summary, this can be achieved by doing the following:<br />
1) Replace all disks in the RAID (one by one)<br />
2) Grow the RAID<br />
3) Expand the filesystem</p>
<p>In this guide i will be working on <strong>/dev/md1</strong></p>
<p>Now, let`s get to work!</p>
<h2><span style="color: #000000;"><strong>Part one: Replace the disks</strong></span></h2>
<p>PS: If your system does not support hot swap, you have to turn of/restart your machine for each disk you are replacing.</p>
<p>Remove a disk in the RAID, then insert a new (bigger) drive.<br />
Check dmesg (or similiar) to get the name of the last drive.</p>
<blockquote><p>[14522870.380610] scsi 15:0:0:0: Direct-Access     ATA      WDC WD15EARS-00Z 80.0 PQ: 0 ANSI: 5<br />
[14522870.381589] sd 15:0:0:0: [<strong>sdm</strong>] 2930277168 512-byte hardware sectors: (1.50 TB/1.36 TiB)<br />
[14522870.381622] sd 15:0:0:0: [<strong>sdm</strong>] Write Protect is off<br />
[14522870.381626] sd 15:0:0:0: [<strong>sdm</strong>] Mode Sense: 00 3a 00 00<br />
[14522870.381673] sd 15:0:0:0: [<strong>sdm</strong>] Write cache: enabled, read cache: enabled, doesn&#8217;t support DPO or FUA<br />
[14522870.381845] sd 15:0:0:0: [<strong>sdm</strong>] 2930277168 512-byte hardware sectors: (1.50 TB/1.36 TiB)<br />
[14522870.381870] sd 15:0:0:0: [<strong>sdm</strong>] Write Protect is off<br />
[14522870.381875] sd 15:0:0:0: [<strong>sdm</strong>] Mode Sense: 00 3a 00 00<br />
[14522870.381918] sd 15:0:0:0: [<strong>sdm</strong>] Write cache: enabled, read cache: enabled, doesn&#8217;t support DPO or FUA<br />
[14522870.381926] <strong> sdm</strong>: unknown partition table<br />
[14522870.397752] sd 15:0:0:0: [<strong>sdm</strong>] Attached SCSI disk<br />
[14522870.397878] sd 15:0:0:0: Attached scsi generic sg9 type 0</p></blockquote>
<p>Now, tell mdadm to add your new drive to the RAID you removed a drive from by doing:</p>
<blockquote><p>mdadm &#8211;manage /dev/<strong>md1</strong> &#8211;add /dev/<strong>sdm</strong></p></blockquote>
<p>Mdadm will then start syncing data to your new drive, to get a ETA of when it`s done (and when you can replace the next drive) check the mdadm status.</p>
<blockquote><p><span style="color: #000000;">root@bais:/home/samba/raid1/test# cat /proc/mdstat<br />
Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10]<br />
md0 : active raid5 sdl[2] sdi[4] sdf[3] sde[1] sdd[0]<br />
5860553728 blocks level 5, 128k chunk, algorithm 2 [5/5] [UUUUU]</span></p>
<p><span style="color: #000000;">md1 : active raid5 sdm[6] sdg[1] sdk[5] sdj[7](F) sdh[2] sdc[3] sda[0]<br />
2441932480 blocks level 5, 64k chunk, algorithm 2 [6/5] [UUUU_U]<br />
<strong> [==&gt;..................]  recovery = 14.2% (69439012/488386496)<strong> finish=155.8min</strong> speed=44805K/sec</strong></span></p>
<p><span style="color: #000000;">unused devices:</span></p></blockquote>
<p>So after around 155 minutes  the drive is active. (And the next one can be replaced)</p>
<p>Repeat this process for each disk in the RAID.</p>
<p>When you have changed all disks, run the command &#8220;mdadm &#8211;manage /dev/md<strong>X</strong> &#8211;remove failed&#8221; to remove any devices listes as failed for the given RAID.</p>
<h2><strong><strong>Part two: Increase the space available for the RAID</strong></strong></h2>
<p>This is done by simply issuing the command:</p>
<blockquote><p>mdadm &#8211;grow /dev/md1 &#8211;size=max</p></blockquote>
<p>And the RAID size is increased, note that this has caused the RAID to start a resync (again):</p>
<blockquote><p>root@bais:~# cat /proc/mdstat<br />
Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10]<br />
md0 : active raid5 sdl[2] sdi[4] sdf[3] sde[1] sdd[0]<br />
5860553728 blocks level 5, 128k chunk, algorithm 2 [5/5] [UUUUU]</p>
<p>md1 : active raid5 sdc[0] sdj[3] sdh[5] sdg[2] sdn[1] sdm[4]<br />
7325692480 blocks level 5, 64k chunk, algorithm 2 [6/6] [UUUUUU]<br />
<strong>[======&gt;..............]  resync = 34.6% (508002752/1465138496) finish=247.0min speed=64561K/sec</strong></p></blockquote>
<p>PS: note that the resync speed has increased by around 20MB/s after all the drives was replaced <img src='http://h3x.no/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>You will now also notice that the RAID reports it`s new size:</p>
<blockquote><p>root@bais:~# mdadm &#8211;detail /dev/md1<br />
/dev/md1:<br />
Version : 00.90<br />
Creation Time : Sat Jun 13 01:55:27 2009<br />
Raid Level : raid5<br />
<strong>Array Size : 7325692480 (6986.32 GiB 7501.51 GB)</strong><br />
Used Dev Size : 1465138496 (1397.26 GiB 1500.30 GB)<br />
Raid Devices : 6<br />
Total Devices : 6<br />
Preferred Minor : 1<br />
Persistence : Superblock is persistent</p>
<p><strong>Update Time : Fri Mar  5 08:03:47 2010</strong><br />
State : active, resyncing<br />
Active Devices : 6<br />
Working Devices : 6<br />
Failed Devices : 0<br />
Spare Devices : 0</p>
<p>Layout : left-symmetric<br />
Chunk Size : 64K</p>
<p><strong>Rebuild Status : 35% complete</strong></p>
<p>UUID : ed415534:2925f54a:352a6ad4:582f9bd3 (local to host bais)<br />
Events : 0.247</p>
<p>Number   Major   Minor   RaidDevice State<br />
0       8       32        0      active sync   /dev/sdc<br />
1       8      208        1      active sync   /dev/sdn<br />
2       8       96        2      active sync   /dev/sdg<br />
3       8      144        3      active sync   /dev/sdj<br />
4       8      192        4      active sync   /dev/sdm<br />
5       8      112        5      active sync   /dev/sdh</p></blockquote>
<h2><strong><strong>Part three: resize file system<br />
</strong></strong></h2>
<p>Start off by unounting the file system in question and perform a file system check to make shure everything is a-ok</p>
<blockquote><p>root@bais:/home/torhenning# <strong>umount /home/samba/raid1</strong><br />
root@bais:/home/torhenning#<strong> fsck /dev/md1</strong><br />
fsck 1.41.4 (27-Jan-2009)<br />
e2fsck 1.41.4 (27-Jan-2009)<br />
/dev/md1 has gone 188 days without being checked, check forced.<br />
Pass 1: Checking inodes, blocks, and sizes</p></blockquote>
<p>Be warned: The fsck CAN take quite a time to finish.</p>
<p>When it`s complete, you are ready for the last step, which is to resize the filesystem:</p>
<blockquote><p>root@bais:/home/torhenning# <strong>resize2fs /dev/md1 6986G</strong><br />
resize2fs 1.41.4 (27-Jan-2009)<br />
Resizing the filesystem on /dev/md1 to 1831337984 (4k) blocks.</p></blockquote>
<p>And voila! Mount up the filesystem again and you are finished! <img src='http://h3x.no/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>


<div class="shr-bookmarks shr-bookmarks-expand shr-bookmarks-center shr-bookmarks-bg-caring-old">
<ul class="socials">
		<li class="shr-comfeed">
			<a href="http://h3x.no/2010/03/02/howto-increase-disk-space-in-a-mdadm-raid/feed" rel="nofollow" class="external" title="Subscribe to the comments for this post?">Subscribe to the comments for this post?</a>
		</li>
		<li class="shr-delicious">
			<a href="http://delicious.com/post?url=http://h3x.no/2010/03/02/howto-increase-disk-space-in-a-mdadm-raid&amp;title=Howto%3A+Increase+disk+space+in+a+mdadm+raid" rel="nofollow" class="external" title="Share this on del.icio.us">Share this on del.icio.us</a>
		</li>
		<li class="shr-digg">
			<a href="http://digg.com/submit?phase=2&amp;url=http://h3x.no/2010/03/02/howto-increase-disk-space-in-a-mdadm-raid&amp;title=Howto%3A+Increase+disk+space+in+a+mdadm+raid" rel="nofollow" class="external" title="Digg this!">Digg this!</a>
		</li>
		<li class="shr-gmail">
			<a href="https://mail.google.com/mail/?ui=2&amp;view=cm&amp;fs=1&amp;tf=1&amp;su=Howto%3A+Increase+disk+space+in+a+mdadm+raid&amp;body=Link: http://h3x.no/2010/03/02/howto-increase-disk-space-in-a-mdadm-raid (sent via shareaholic)%0D%0A%0D%0A----%0D%0A I%20currently%20have%20a%20Ubuntu%20Linux%20server%20running%20two%20mdadm%20RAID%60s.%20One%20of%20the%20RAID%20sets%20is%20set%20up%20using%206%20x%20500%20GB%20SATA%20drives.%20Now%20i%20have%20purchased%206%20x%201500%20GB%20SATA%20drives%20that%20will%20replace%20the%20old%20disks%2C%20but%20the%20challenge%20is%20to%20increase%20the%20RAID%20and%20filesystem%20without%20loosing%20any%20data%20or%20having%20down" rel="nofollow" class="external" title="Email this via Gmail">Email this via Gmail</a>
		</li>
		<li class="shr-reddit">
			<a href="http://reddit.com/submit?url=http://h3x.no/2010/03/02/howto-increase-disk-space-in-a-mdadm-raid&amp;title=Howto%3A+Increase+disk+space+in+a+mdadm+raid" rel="nofollow" class="external" title="Share this on Reddit">Share this on Reddit</a>
		</li>
		<li class="shr-stumbleupon">
			<a href="http://www.stumbleupon.com/submit?url=http://h3x.no/2010/03/02/howto-increase-disk-space-in-a-mdadm-raid&amp;title=Howto%3A+Increase+disk+space+in+a+mdadm+raid" rel="nofollow" class="external" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a>
		</li>
		<li class="shr-technorati">
			<a href="http://technorati.com/faves?add=http://h3x.no/2010/03/02/howto-increase-disk-space-in-a-mdadm-raid" rel="nofollow" class="external" title="Share this on Technorati">Share this on Technorati</a>
		</li>
		<li class="shr-twitter">
			<a href="http://twitter.com/home?status=Howto%3A+Increase+disk+space+in+a+mdadm+raid+-+http://b2l.me/aj5xm8&amp;source=shareaholic" rel="nofollow" class="external" title="Tweet This!">Tweet This!</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>

]]></content:encoded>
			<wfw:commentRss>http://h3x.no/2010/03/02/howto-increase-disk-space-in-a-mdadm-raid/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to get your mdadm RAID`s back after OS crash or a reinstall</title>
		<link>http://h3x.no/2009/08/28/how-to-get-your-mdadm-raids-back-after-os-crash-reinstall</link>
		<comments>http://h3x.no/2009/08/28/how-to-get-your-mdadm-raids-back-after-os-crash-reinstall#comments</comments>
		<pubDate>Fri, 28 Aug 2009 21:26:28 +0000</pubDate>
		<dc:creator>Tor Henning Ueland</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[crash]]></category>
		<category><![CDATA[mdadm]]></category>
		<category><![CDATA[raid]]></category>

		<guid isPermaLink="false">http://www.h3x.no/?p=108</guid>
		<description><![CDATA[If all your disks are connected, simply try a: mdadm &#8211;assemble &#8211;scan This should find and activate all your RAID systems Subscribe to the comments for this post? Share this on del.icio.us Digg this! Email this via Gmail Share this on Reddit Stumble upon something good? Share it on StumbleUpon Share this on Technorati Tweet [...]]]></description>
			<content:encoded><![CDATA[<p>If all your disks are connected, simply try a:</p>
<p>mdadm &#8211;assemble &#8211;scan</p>
<p>This should find and activate all your RAID systems <img src='http://h3x.no/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>


<div class="shr-bookmarks shr-bookmarks-expand shr-bookmarks-center shr-bookmarks-bg-caring-old">
<ul class="socials">
		<li class="shr-comfeed">
			<a href="http://h3x.no/2009/08/28/how-to-get-your-mdadm-raids-back-after-os-crash-reinstall/feed" rel="nofollow" class="external" title="Subscribe to the comments for this post?">Subscribe to the comments for this post?</a>
		</li>
		<li class="shr-delicious">
			<a href="http://delicious.com/post?url=http://h3x.no/2009/08/28/how-to-get-your-mdadm-raids-back-after-os-crash-reinstall&amp;title=How+to+get+your+mdadm+RAID%60s+back+after+OS+crash+or+a+reinstall" rel="nofollow" class="external" title="Share this on del.icio.us">Share this on del.icio.us</a>
		</li>
		<li class="shr-digg">
			<a href="http://digg.com/submit?phase=2&amp;url=http://h3x.no/2009/08/28/how-to-get-your-mdadm-raids-back-after-os-crash-reinstall&amp;title=How+to+get+your+mdadm+RAID%60s+back+after+OS+crash+or+a+reinstall" rel="nofollow" class="external" title="Digg this!">Digg this!</a>
		</li>
		<li class="shr-gmail">
			<a href="https://mail.google.com/mail/?ui=2&amp;view=cm&amp;fs=1&amp;tf=1&amp;su=How+to+get+your+mdadm+RAID%60s+back+after+OS+crash+or+a+reinstall&amp;body=Link: http://h3x.no/2009/08/28/how-to-get-your-mdadm-raids-back-after-os-crash-reinstall (sent via shareaholic)%0D%0A%0D%0A----%0D%0A If%20all%20your%20disks%20are%20connected%2C%20simply%20try%20a%3A%0D%0A%0D%0Amdadm%20--assemble%20--scan%0D%0A%0D%0AThis%20should%20find%20and%20activate%20all%20your%20RAID%20systems%20%3A%29" rel="nofollow" class="external" title="Email this via Gmail">Email this via Gmail</a>
		</li>
		<li class="shr-reddit">
			<a href="http://reddit.com/submit?url=http://h3x.no/2009/08/28/how-to-get-your-mdadm-raids-back-after-os-crash-reinstall&amp;title=How+to+get+your+mdadm+RAID%60s+back+after+OS+crash+or+a+reinstall" rel="nofollow" class="external" title="Share this on Reddit">Share this on Reddit</a>
		</li>
		<li class="shr-stumbleupon">
			<a href="http://www.stumbleupon.com/submit?url=http://h3x.no/2009/08/28/how-to-get-your-mdadm-raids-back-after-os-crash-reinstall&amp;title=How+to+get+your+mdadm+RAID%60s+back+after+OS+crash+or+a+reinstall" rel="nofollow" class="external" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a>
		</li>
		<li class="shr-technorati">
			<a href="http://technorati.com/faves?add=http://h3x.no/2009/08/28/how-to-get-your-mdadm-raids-back-after-os-crash-reinstall" rel="nofollow" class="external" title="Share this on Technorati">Share this on Technorati</a>
		</li>
		<li class="shr-twitter">
			<a href="http://twitter.com/home?status=How+to+get+your+mdadm+RAID%60s+back+after+OS+crash+or+a+reinstall+-+http://b2l.me/aj7wp8&amp;source=shareaholic" rel="nofollow" class="external" title="Tweet This!">Tweet This!</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>

]]></content:encoded>
			<wfw:commentRss>http://h3x.no/2009/08/28/how-to-get-your-mdadm-raids-back-after-os-crash-reinstall/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
