<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="../assets/xml/rss.xsl" media="all"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Stefano Rivera (Posts about raid)</title><link>https://stefanorivera.com/</link><description></description><atom:link href="https://stefanorivera.com/categories/raid.xml" rel="self" type="application/rss+xml"></atom:link><language>en</language><copyright>Contents © 2025 &lt;a href="mailto:stefano@rivera.za.net"&gt;Stefano Rivera&lt;/a&gt; 
&lt;a rel="license" href="https://creativecommons.org/licenses/by-sa/4.0/"&gt;
&lt;img alt="Creative Commons License BY-SA"
     class="cc-license-button"
     src="/assets/img/cc-by-sa-4.0.svg"&gt;&lt;/a&gt;</copyright><lastBuildDate>Mon, 10 Nov 2025 10:14:04 GMT</lastBuildDate><generator>Nikola (getnikola.com)</generator><docs>http://blogs.law.harvard.edu/tech/rss</docs><item><title>Linux on-line Software RAID reshaping</title><link>https://stefanorivera.com/posts/2007/04/05/linux-line-software-raid-reshaping/</link><dc:creator>Stefano Rivera</dc:creator><description>&lt;p&gt;I first read about on-line Software RAID reshaping a year ago &lt;a href="https://lwn.net/Articles/169140/"&gt;on LWN&lt;/a&gt;. Today I tried it on a live system (that's too big to be backed-up first :-))&lt;/p&gt;
&lt;p&gt;I added 2 250GB drives to my existing RAID5 array of 4, making for a 1.2TiB array. The reshape took a while...:&lt;/p&gt;
&lt;div class="code"&gt;&lt;pre class="code literal-block"&gt;&lt;span class="n"&gt;md0&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;active&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;raid5&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;sdb1&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="n"&gt;4&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;sda1&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="n"&gt;5&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;sdf1&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="n"&gt;2&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;sde1&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="n"&gt;3&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;sdd1&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="n"&gt;1&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;sdc1&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="n"&gt;0&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;
&lt;span class="w"&gt;      &lt;/span&gt;&lt;span class="mi"&gt;732587712&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;blocks&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;super&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;0.91&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;level&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;64&lt;/span&gt;&lt;span class="n"&gt;k&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;chunk&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;algorithm&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="n"&gt;6/6&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="n"&gt;UUUUUU&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;
&lt;span class="w"&gt;      &lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="n"&gt;&amp;gt;....................&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="n"&gt;reshape&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="mf"&gt;1.9&lt;/span&gt;&lt;span class="o"&gt;%&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;4800784&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="mi"&gt;244195904&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;finish&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mf"&gt;397.4&lt;/span&gt;&lt;span class="nf"&gt;min&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;speed&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;10034&lt;/span&gt;&lt;span class="n"&gt;K&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;sec&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;But when it was done:&lt;/p&gt;
&lt;div class="code"&gt;&lt;pre class="code literal-block"&gt;$&lt;span class="w"&gt; &lt;/span&gt;df&lt;span class="w"&gt; &lt;/span&gt;-h
/dev/md0&lt;span class="w"&gt;              &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;.2T&lt;span class="w"&gt;  &lt;/span&gt;657G&lt;span class="w"&gt;  &lt;/span&gt;509G&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="m"&gt;57&lt;/span&gt;%&lt;span class="w"&gt; &lt;/span&gt;/mnt/storage
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;This is one of the reasons why I love software RAID, while you have a &lt;em&gt;kak&lt;/em&gt; load more I/O through the PCI(E) bus than you would with hardware RAID, you get the flexibility of the highest-end hardware controllers on a normal PC motherboard.&lt;/p&gt;
&lt;p&gt;And of course, should things go pear-shaped, I don't need to find an identical controller, I just have to find a box with 6 SATA sockets.&lt;/p&gt;
&lt;h3&gt;HOWTO reshape&lt;/h3&gt;
&lt;p&gt;Lets say you have 4 SATA drives, &lt;code&gt;/dev/sda&lt;/code&gt; to &lt;code&gt;/dev/sdd&lt;/code&gt;, and you are adding a new one &lt;code&gt;/dev/sde&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Check that everything is happy:&lt;/p&gt;
&lt;div class="code"&gt;&lt;pre class="code literal-block"&gt;&lt;span class="err"&gt;$&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;cat&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="k"&gt;proc&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;mdstat&lt;/span&gt;
&lt;span class="n"&gt;md0&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;active&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;raid5&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;sdd1&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="n"&gt;3&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;sdc1&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="n"&gt;1&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;sdb1&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="n"&gt;2&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;sda1&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="n"&gt;0&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;
&lt;span class="w"&gt;      &lt;/span&gt;&lt;span class="mi"&gt;937705728&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;blocks&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;level&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;128&lt;/span&gt;&lt;span class="n"&gt;k&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;chunk&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;algorithm&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="n"&gt;4/4&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="n"&gt;UUUU&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Partition the new drive (clone &lt;code&gt;sda&lt;/code&gt;s partition table onto &lt;code&gt;sde&lt;/code&gt;):&lt;/p&gt;
&lt;div class="code"&gt;&lt;pre class="code literal-block"&gt;# sfdisk -d /dev/sda | sfdisk /dev/sde
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Add the new drive:&lt;/p&gt;
&lt;div class="code"&gt;&lt;pre class="code literal-block"&gt;# mdadm -a /dev/md0 /dev/sde1
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Grow the RAID:&lt;/p&gt;
&lt;div class="code"&gt;&lt;pre class="code literal-block"&gt;# mdadm --grow -n5 /dev/md0
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Watch the progress:&lt;/p&gt;
&lt;div class="code"&gt;&lt;pre class="code literal-block"&gt;$&lt;span class="w"&gt; &lt;/span&gt;watch&lt;span class="w"&gt; &lt;/span&gt;cat&lt;span class="w"&gt; &lt;/span&gt;/proc/mdstat
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Grow the filesystem:&lt;/p&gt;
&lt;div class="code"&gt;&lt;pre class="code literal-block"&gt;&lt;span class="gh"&gt;#&lt;/span&gt; resize_reiserfs /dev/md0
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;See the extra space:&lt;/p&gt;
&lt;div class="code"&gt;&lt;pre class="code literal-block"&gt;$&lt;span class="w"&gt; &lt;/span&gt;df&lt;span class="w"&gt; &lt;/span&gt;-h
&lt;/pre&gt;&lt;/div&gt;</description><category>linux</category><category>raid</category><guid>http://tumbleweed.org.za/2007/04/05/linux-line-software-raid-reshaping</guid><pubDate>Thu, 05 Apr 2007 15:43:43 GMT</pubDate></item><item><title>Horrific performance with 3ware RAID</title><link>https://stefanorivera.com/posts/2007/02/16/horrific-performance-3ware-raid/</link><dc:creator>Stefano Rivera</dc:creator><description>&lt;p&gt;I've been enjoying our server at &lt;a href="https://uk2.net/"&gt;UK2.net&lt;/a&gt;. It's a pretty speedy machine (although a little light on RAM - I suspect that they don't want people running Xen), and it's connected to a fat pipe.
But I've been experiencing a lot of bad lockups.&lt;/p&gt;
&lt;p&gt;I traced the problem to &lt;a href="http://www.postfix.org/postmap.1.html"&gt;postmap&lt;/a&gt;ing the &lt;a href="http://www.uceprotect.net/en/index.php"&gt;uceprotect.net&lt;/a&gt; RBL file. They recommend that you rsync this file from them, and then postmap it into a fast lookup database for postfix, rather than using their DNSRBL service. But running the postmap was taking my box 40 mins. The same operation, on a loaded, lower-spec, 2 year old server took 2 mins (yes this server also has RAID1 on the volume concerned). On my UK2 box, while the postmap was running, the machine became totally unresponsive, and it could take a minute or two to log in, serve a web page, or even execute a basic command like &lt;code&gt;ps&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Clearly something wasn't right. And it was something in the IO system. The only answer is the 3ware RAID controller. (It's a 8006-2, doing RAID-1) I know these controllers have a big buffer, so I looked up the 3ware website, for &lt;a href="http://www.3ware.com/KB/article.aspx?id=11050"&gt;tuning guidance&lt;/a&gt;. I followed it to the letter, and things didn't really improve. I tried the deadline scheduler, and tweaking the buffers, but it only got marginally better.&lt;/p&gt;
&lt;p&gt;Personally, I've always used software RAID, even for RAID-5, and I've never had bad performance like that. And having the RAID in a portable format has really helped with recovery in the past. I understand that Windows monkeys have to use hardware RAID (because their software RAID sucks so much), but is this kind of performance normal?&lt;/p&gt;
&lt;p&gt;I've asked UK2 to chuck my controller and give me software RAID :-)&lt;/p&gt;
&lt;h3&gt;Update&lt;/h3&gt;
&lt;p&gt;I've now got software RAID 1, and postmap runs in 25 seconds. That's what I call a 60x speed improvement :-)&lt;/p&gt;
&lt;p&gt;Oh, and the system is totally responsive while the postmap runs.&lt;/p&gt;</description><category>3ware</category><category>hardware</category><category>linux</category><category>raid</category><category>software</category><category>uk2</category><guid>http://tumbleweed.org.za/2007/02/16/horrific-performance-3ware-raid</guid><pubDate>Fri, 16 Feb 2007 08:01:54 GMT</pubDate></item></channel></rss>