<?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>Red Leopard &#187; linux</title>
	<atom:link href="http://www.redleopard.com/tag/linux/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.redleopard.com</link>
	<description>A Stranger in a Strange Land</description>
	<lastBuildDate>Mon, 07 Jun 2010 22:59:44 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Apache Directory Indexing</title>
		<link>http://www.redleopard.com/2009/12/apache-directory-indexing/</link>
		<comments>http://www.redleopard.com/2009/12/apache-directory-indexing/#comments</comments>
		<pubDate>Sun, 06 Dec 2009 22:47:59 +0000</pubDate>
		<dc:creator>kelly</dc:creator>
				<category><![CDATA[KellyBlog]]></category>
		<category><![CDATA[httpd]]></category>
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://www.redleopard.com/?p=812</guid>
		<description><![CDATA[Sometimes a problem persists long enough—is an irritant long enough—that I&#8217;ll burn an entire Sunday morning simply out of spite. Today&#8217;s irrational time-waste went to solving &#8220;Directory index forbidden by Options directive.&#8221;


[marmaduke ~] $ cat /var/log/httpd/error_log \
 &#124; grep '\[error\]' \
 &#124; head -1
[Sun Dec 06 09:25:05 2009] [error] [client 192.168.2.29]↩
Directory index forbidden by Options [...]]]></description>
			<content:encoded><![CDATA[<p>Sometimes a problem persists long enough—is an irritant long enough—that I&#8217;ll burn an entire Sunday morning simply out of spite. Today&#8217;s irrational time-waste went to solving &#8220;Directory index forbidden by Options directive.&#8221;</p>
<div class="terminal">
<pre>
[marmaduke ~] $ <span style="color: green;">cat /var/log/httpd/error_log \
 | grep '\[error\]' \
 | head -1</span>
[Sun Dec 06 09:25:05 2009] [error] [client 192.168.2.29]↩
Directory index forbidden by Options directive:↩
/var/www/documentation/public_html/
</pre>
</div>
<p>I have a development server that I use to offload work from my laptop.</p>
<div class="terminal">
<pre>
[marmaduke ~] $ <span style="color: green;">hostname</span>
marmaduke

[marmaduke ~] $ <span style="color: green;">cat /etc/redhat-release</span>
CentOS release 5.4 (Final)
</pre>
</div>
<p>Among other things, marmaduke hosts scads of apache virtual hosts, including documentation. I&#8217;ve wanted to index the documentation directory for quite sometime but never could get apache configured to auto index.</p>
<p>Every configuration problem has already been solved by someone else. A quick search (<a href="http://www.google.com/search?hl=en&#038;as_q=apache+allow+directory+index">apache+allow+directory+index</a>) yielded surprisingly consistent instructions.</p>
<p>These instructions yielded consistent failure for me. I simply could not get auto indexing to work. Until now.</p>
<p>My apache installation is a basic yum install.</p>
<div class="terminal">
<pre>
[marmaduke ~] $ <span style="color: green;">yum list | grep httpd | grep installed</span>
httpd.x86_64           2.2.3-31.el5.centos    installed
httpd-devel.x86_64     2.2.3-31.el5.centos    installed
httpd-manual.x86_64    2.2.3-31.el5.centos    installed
</pre>
</div>
<p>I&#8217;ve extracted (below) a partial listing of relevant parts from the httpd.conf file.</p>
<p>I include configuration files from two directories: module configurations in /etc/httpd/conf.d/ and all virtual host configurations in /etc/httd/conf.d/hosts/.</p>
<p>For the most part, I leave httpd.conf untouched. Note that apache runs under the user and group named &#8216;apache&#8217;.</p>
<div class="terminal">
<pre>
<span style="color: gray;"># /etc/httpd/conf/httpd.conf (partial listing)</span>
Listen 80

Include conf.d/*.conf
Include conf.d/hosts/*.conf

User apache
Group apache

ServerName marmaduke:80
UseCanonicalName Off

DocumentRoot "/var/www/html"

&lt;Directory /&gt;
    Options FollowSymLinks
    AllowOverride None
&lt;/Directory&gt;

&lt;Directory "/var/www/html"&gt;
    Options Indexes FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all
&lt;/Directory&gt;

DirectoryIndex index.html index.html.var

IndexOptions FancyIndexing VersionSort NameWidth=* HTMLTable

NameVirtualHost *:80
</pre>
</div>
<p>Permissions are important.</p>
<p>I place my documentation directories in /var/www/documentation/public_html and the entire tree from /var/www/documentation downwards has the same user and group name. All directories have 755 permission and all non-directories have 644 permission.</p>
<div class="terminal">
<pre>
[marmaduke ~] $ <span style="color: green;">ll /var/www</span>
drwxr-xr-x 3 kelly apache 4096 Dec  6 09:23 documentation

[marmaduke ~] $ <span style="color: green;">ll /var/www/documentation</span>
drwxr-xr-x 7 kelly apache 4096 Dec  6 11:51 public_html

[marmaduke ~] $ <span style="color: green;">ll /var/www/documentation/public_html</span>
-rw-r--r-- 1 kelly apache 5174 Dec  6 09:33 favicon.ico
drwxr-xr-x 2 kelly apache 4096 Dec  6 09:21 icecast-2.3.2
drwxr-xr-x 3 kelly apache 4096 Dec  6 12:00 mysql-5.0
drwxr-xr-x 4 kelly apache 4096 Dec  6 11:50 mysql-5.1
drwxr-xr-x 3 kelly apache 4096 Dec  6 11:51 mysql-5.4
drwxr-xr-x 3 kelly apache 4096 Dec  6 11:51 mysql-5.5

[marmaduke ~] $ <span style="color: green;">ll /var/www/documentation/public_html/mysql-5.0</span>
drwxr-xr-x 3 kelly apache 4096 Dec  6 10:05 en
</pre>
</div>
<p>My virtual host enables indexing through the Directory directive. So far, this is consistent with most of the instructions found through web search. Yet, auto indexing still didn&#8217;t work for me.</p>
<div class="terminal">
<pre>
<span style="color: gray;"># /etc/httpd/conf.d/hosts/documentation.conf</span>
&lt;VirtualHost *:80&gt;
  DocumentRoot /var/www/documentation/public_html
  ServerName documentation.site
  Options Indexes FollowSymLinks

  &lt;Directory "/var/www/documentation/public_html"&gt;
    Options Indexes FollowSymLinks
    Order allow,deny
    Allow from all
  &lt;/Directory&gt;

  RewriteEngine on
  RewriteLogLevel 1
&lt;/VirtualHost&gt;
</pre>
</div>
<p>It turns out that there is a nastly little surprise in one of the configuration files that comes standard with the centos yum install. </p>
<p>Inside LocationMatch, there the Options directive turns off Indexes. From the apache documentation, &#8220;<b>Regardless of any access restrictions placed in &lt;Directory&gt; sections, the &lt;Location&gt; section will be evaluated last…</b>&#8221;</p>
<div class="terminal">
<pre>
<span style="color: gray;"># /etc/httpd/conf.d/welcome.conf</span>
&lt;LocationMatch "^/+$"&gt;

  # this is the culprit!
  <b>Options -Indexes</b>

  ErrorDocument 403 /error/noindex.html
&lt;/LocationMatch&gt;
</pre>
</div>
<p>Since <code>LocationMatch</code> is evaluated last, the <code>-Indexes</code> parameter disables options set in any <code>Directory</code> directive. Either changing the parameter <code>-Indexes</code> to <code>Indexes</code> or deleting the welcome.conf file will allow auto indexing (assuming the other configurations are correct).</p>
<p><img width="592" height="445" alt="screenshot of apache directory listing" src="/images/apache-directory-index.jpg" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.redleopard.com/2009/12/apache-directory-indexing/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Software RAID 10</title>
		<link>http://www.redleopard.com/2009/01/software-raid-10/</link>
		<comments>http://www.redleopard.com/2009/01/software-raid-10/#comments</comments>
		<pubDate>Sun, 18 Jan 2009 19:25:57 +0000</pubDate>
		<dc:creator>kelly</dc:creator>
				<category><![CDATA[KellyBlog]]></category>
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://www.redleopard.com/?p=511</guid>
		<description><![CDATA[I&#8217;ve been putting off building the software RAID10 on marmaduke. Today, I put it off no longer.
The server marmaduke has six storage devices (2 IDE and 4 SATA)


$ ls -1 /dev/hd?
/dev/hde
/dev/hdf

$ ls -1 /dev/sd?
/dev/sda
/dev/sdb
/dev/sdc
/dev/sdd


The CDROM is attached as /dev/hde and a 300GB HDD as /dev/hdf on which I&#8217;ve installed CentOS 5.2. The four SATA drives [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been putting off building the software RAID10 on marmaduke. Today, I put it off no longer.</p>
<p>The server marmaduke has six storage devices (2 IDE and 4 SATA)</p>
<div class="terminal">
<pre>
$ ls -1 /dev/hd?
/dev/hde
/dev/hdf

$ ls -1 /dev/sd?
/dev/sda
/dev/sdb
/dev/sdc
/dev/sdd
</pre>
</div>
<p>The CDROM is attached as /dev/hde and a 300GB HDD as /dev/hdf on which I&#8217;ve installed CentOS 5.2. The four SATA drives will be used to build a RAID 10. I&#8217;ve read through a number of postings on how to build a software RAID. The cleanest, shortest and clearest of them is on <a href="http://www.tgharold.com/techblog/2006/08/creating-4-disk-raid10-using-mdadm.shtml">tgharold.com</a>.</p>
<h3>mknod</h3>
<p>First, create a node for the array.</p>
<div class="terminal">
<pre>
# mknod /dev/md0 b 9 0
</pre>
</div>
<p>I chose <code>md0</code> since it was available.</p>
<p>The parameter &#8216;b&#8217; directs <code>mknod</code> to create a block (buffered) special file.</p>
<p>The parameter &#8216;9&#8242; is the Major version. (huh?) Seems the correct parameter can be found in </code>/proc/devices</code>. (see also, <a href="http://www.centos.org/docs/5/html/5.2/Virtualization/sect-Virtualization-Installation_and_Configuration_of_Para_virtualized_Drivers_on_Red_Hat_Enterprise_Linux_3.html">centos docs</a>)</p>
<div class="terminal">
<pre>
$ cat /proc/devices | grep -e "md$"
  9 md
</pre>
</div>
<p>The parameter '0' corresponds to the last digit in the device <code>/dev/md0</code>. tgharold.com points out that the digit used in the device name should be the same as the last parameter. Why? Dunno. Something to look up some day.</p>
<h3>fdisk</h3>
<p>Second, partition the disks, each and every one.</p>
<div class="terminal">
<pre>
# fdisk /dev/sda
# fdisk /dev/sdb
# fdisk /dev/sdc
# fdisk /dev/sdd
</pre>
</div>
<p>I don't know why I set the boot flag. The important point is to set the ID to 'fd' which is 'Linux raid autodetect'.</p>
<div class="terminal">
<pre>
   Device  Boot  Start    End     Blocks  Id  System
/dev/sda1  *         1  60801  488384001  fd  Linux raid autodetect
/dev/sdb1  *         1  36481  293033601  fd  Linux raid autodetect
/dev/sdc1  *         1  36481  293033601  fd  Linux raid autodetect
/dev/sdd1  *         1  36481  293033601  fd  Linux raid autodetect
</pre>
</div>
<p>One of my drives is larger than the others. Three drives (Seagate ST3300620AS) where previously used in a RAID5. It's impossible to find these drives any longer so I picked up the closest match (Seagate ST3500630AS). It has a larger capacity but otherwise the specs match. In a RAID10, the larger drive's extra space (~200GB) will go unused.</p>
<p>I formatted the drives but perhaps it was unnecessary. I did this as a check on each drive before I began building the array. Didn't seem to hurt anything.</p>
<div class="terminal">
<pre>
# mkfs.ext3 /dev/sda1
# mkfs.ext3 /dev/sda2
# mkfs.ext3 /dev/sda3
# mkfs.ext3 /dev/sda4
</pre>
</div>
<h3>mdadm</h3>
<p>Third, time to pull the trigger. Let <code>mdadm</code> do the heavy lifting.</p>
<div class="terminal">
<pre>
# mdadm             \
  --create /dev/md0 \
  -v                \
  --raid-devices=4  \
  --chunk=32        \
  --level=raid10    \
  /dev/sda1 /dev/sdb1 /dev/sdc1 /dev/sdd1
</pre>
</div>
<h3>mkfs</h3>
<p>Fourth, whether you format the drive individually or not you must format the RAID.</p>
<div class="terminal">
<pre>
# mkfs.ext3 /dev/md0
</pre>
</div>
<h3>mount</h3>
<p>Finally, mount the RAID.</p>
<div class="terminal">
<pre>
# mount /dev/md0 /mnt/xen
</pre>
</div>
<p>Sweet. </p>
<div class="terminal">
<pre>
$ df -h
Filesystem Size Used Avail Use% Mounted on /dev/mapper/VolGroup00-LogVol00
           287G  36G  237G  14% /
/dev/hdf1   99M  19M   76M  20% /boot
tmpfs      3.9G    0  3.9G   0% /dev/shm
/dev/md0   551G 198M  523G   1% /mnt/xen
</pre>
</div>
<p>Now, where is that Xen tutorial?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.redleopard.com/2009/01/software-raid-10/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>RAID 01 vs. RAID 10</title>
		<link>http://www.redleopard.com/2009/01/raid-01-vs-raid-10/</link>
		<comments>http://www.redleopard.com/2009/01/raid-01-vs-raid-10/#comments</comments>
		<pubDate>Sun, 18 Jan 2009 19:25:29 +0000</pubDate>
		<dc:creator>kelly</dc:creator>
				<category><![CDATA[KellyBlog]]></category>
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://www.redleopard.com/?p=525</guid>
		<description><![CDATA[I just finished building a four-drive software RAID10 on marmaduke and wanted to jot down my thoughts on RAID failure. In particular, I read a number of postings on the difference between RAID 01 and RAID 10. None of them satisfactory described the differences and how those differences changed when adding more drives.
Marmaduke only has [...]]]></description>
			<content:encoded><![CDATA[<p>I just finished building a four-drive software RAID10 on marmaduke and wanted to jot down my thoughts on RAID failure. In particular, I read a number of postings on the difference between RAID 01 and RAID 10. None of them satisfactory described the differences and how those differences changed when adding more drives.</p>
<p>Marmaduke only has four drives in its array. Most of the web postings dealt with four drives but I also wanted to see the impact on six drives. Here is a hypothetical set of six drives.</p>
<div class="terminal">
<pre>
Six Drives:
  /dev/sda  a
  /dev/sdb  b
  /dev/sdc  c
  /dev/sdd  d
  /dev/sde  e
  /dev/sdf  f
</pre>
</div>
<p>For clarity, I will refer to <code>/dev/sda</code> simply as &#8216;a&#8217;, and so on.</p>
<p>Recall that RAID&nbsp;0 &#8217;stripes&#8217; two or more drives and RAID&nbsp;1 &#8216;mirrors&#8217; two drives.</p>
<p><strong>RAID 01 Composition</strong></p>
<div class="terminal">
<pre>
Four Drive RAID 01
  STRIPE:   a  b     as  0
  STRIPE:   c  d     as  1
  MIRROR:   0  1     as  R01 (RAID 0+1)

Six Drive RAID 01
  STRIPE:   a  b  c  as  0
  STRIPE:   d  e  f  as  1
  MIRROR:   0  1     as  R01 (RAID 0+1)
</pre>
</div>
<p>In both the four and six disk arrays, RAID 01 mirrors two striped arrays. Each striped array can contain two or more drives but there are always only two striped arrays. (A mirror has only two subarrays.)</p>
<p><strong>RAID 10 Composition</strong></p>
<div class="terminal">
<pre>
Four Drive RAID 10
  MIRROR:   a  b     as  0
  MIRROR:   c  d     as  1
  STRIPE:   0  1     as  R10 (RAID 1+0)

Six Drive RAID 10
  MIRROR:   a  b     as  0
  MIRROR:   c  d     as  1
  MIRROR:   e  f     as  2
  STRIPE:   0  1  2  as  R10 (RAID 1+0)
</pre>
</div>
<p>In both the four and six disk arrays, RAID 10 stripes two or more mirrored raids. Each mirror has exactly two disks.</p>
<p><strong>01 vs. 10</strong></p>
<p>Which is better? Both cost the same in terms of disk drives. Both yield the same final RAID capacity. Performance is (for my purposes) the same.</p>
<p>I conclude that the difference is primarily in the failure rates between the two drives. There are two types of failures.</p>
<p>First is a failure that takes out a drive but not the array. Replace the drive and you can rebuild the array.</p>
<p>Second is a failure that takes out a drive and the array. Nothing you can do. The array is lost. Game over.</p>
<p>Which drive or drive set cause a catastrophic array loss? I&#8217;ve created two tables (ah, the beauty of pure 7-bit ASCII) to detail every scenario for both a 4-drive and a 6-drive array of both RAID 01 and RAID 10.</p>
<p>An asterisk denotes a catastrophic failure.</p>
<p>Column 1 : &#8220;F&#8221;, number of drives that failed in the array.</p>
<p>Column 2 : &#8220;DRIVES&#8221;, each drive in the array.</p>
<p>Column 3 : &#8220;RO1&#8243;, subarrays for RAID 01.</p>
<p>Column 4 : &#8220;R10&#8243;, subarrays for RAID 10.</p>
<p>Column 5 : &#8220;RAIDS&#8221;, the two final arrays.</p>
<div class="terminal">
<pre>
            Four Drive Arrays

       DRIVES     R01    R10     RAIDS
    ...........   ...   .....   ...  ...
F   a b c d       0 1   0 1     R01  R10
----------------------------------------
0 |             |     |       |
----------------------------------------
  |       *     |   * |       |
1 |     *       |   * |       |
  |   *         | *   |       |
  | *           | *   |       |
----------------------------------------
  |     * *     |   * |   *   |       *
  |   *   *     | * * |       |  *
2 |   * *       | * * |       |  *
  | *     *     | * * |       |  *
  | *   *       | * * |       |  *
  | * *         | *   | *     |       *
----------------------------------------
  |   * * *     | * * |   *   |  *    *
3 | *   * *     | * * |   *   |  *    *
  | * *   *     | * * | *     |  *    *
  | * * *       | * * | *     |  *    *
----------------------------------------
4 | * * * *     | * * | * *   |  *    *
----------------------------------------
</pre>
</div>
<p>Neither RAID configurations can survive a 3 or 4 drive failure.</p>
<p>Both configurations can survive a 1 drive failure. One of the subarrays in RAID 01 always fail with a single drive failure but it doesn&#8217;t bring down the array. In RAID 10, the subarray doesn&#8217;t fail because the subarray is a mirror.</p>
<p>With four drives, there are six possible combinations of two drive failures. In this case, RAID 10 has twice the survival rate (two failure points) as does RAID 01 (four failure points).</p>
<div class="terminal">
<pre>
            Six Drive Arrays

       DRIVES     R01    R10     RAIDS
    ...........   ...   .....   ...  ...
    a b c d e f   0 1   0 1 2   R01  R10
----------------------------------------
0 |             |     |       |
----------------------------------------
  |           * |   * |       |
  |         *   |   * |       |
1 |       *     |   * |       |
  |     *       | *   |       |
  |   *         | *   |       |
  | *           | *   |       |
----------------------------------------
  |         * * |   * |     * |       *
  |       *   * |   * |       |
  |       * *   |   * |       |
  |     *     * | * * |       |  *
  |     *   *   | * * |       |  *
  |     * *     | * * |   *   |  *    *
2 |   *       * | * * |       |  *
  |   *     *   | * * |       |  *
  |   *   *     | * * |       |  *
  |   * *       | *   |       |
  | *         * | * * |       |  *
  | *       *   | * * |       |  *
  | *     *     | * * |       |  *
  | *   *       | *   |       |
  | * *         | *   | *     |       *
----------------------------------------
  |       * * * |   * |     * |       *
  |     *   * * | * * |     * |  *    *
  |     * *   * | * * |   *   |  *    *
  |     * * *   | * * |   *   |  *    *
  |   *     * * | * * |     * |  *    *
  |   *   *   * | * * |       |  *
  |   *   * *   | * * |       |  *
  |   * *     * | * * |       |  *
  |   * *   *   | * * |       |  *
  |   * * *     | * * |   *   |  *    *
3 | *       * * | * * |     * |  *    *
  | *     *   * | * * |       |  *
  | *     * *   | * * |       |  *
  | *   *     * | * * |       |  *
  | *   *   *   | * * |       |  *
  | *   * *     | * * |   *   |  *    *
  | * *       * | * * | *     |  *    *
  | * *     *   | * * | *     |  *    *
  | * *   *     | * * | *     |  *    *
  | * * *       | *   | *     |       *
----------------------------------------
  |     * * * * | * * |   * * |  *    *
  |   *   * * * | * * |     * |  *    *
  |   * *   * * | * * |     * |  *    *
  |   * * *   * | * * |   *   |  *    *
  |   * * * *   | * * |   *   |  *    *
  | *     * * * | * * |     * |  *    *
4 | *   *   * * | * * |     * |  *    *
  | *   * *   * | * * |   *   |  *    *
  | *   * * *   | * * |   *   |  *    *
  | * *     * * | * * | *   * |  *    *
  | * *   *   * | * * | *     |  *    *
  | * *   * *   | * * | *     |  *    *
  | * * *     * | * * | *     |  *    *
  | * * *   *   | * * | *     |  *    *
  | * * * *     | * * | *     |  *    *
----------------------------------------
  |   * * * * * | * * |   * * |  *    *
  | *   * * * * | * * |   * * |  *    *
5 | * *   * * * | * * | *   * |  *    *
  | * * *   * * | * * | *   * |  *    *
  | * * * *   * | * * | * *   |  *    *
  | * * * * *   | * * | * *   |  *    *
----------------------------------------
6 | * * * * * * | * * | * * * |  *    *
----------------------------------------
</pre>
</div>
<p>With a six drive array, RAID 10 has three failure points if two drives fail. However, RAID 01 has nine failure points.</p>
<p>Finally if three drives fail, RAID 10 has 12 failure points compared to RAID 01 which has 18 failure points. In the following table, &#8216;prm&#8217; is the number of permutations for that number of drive failures.</p>
<div class="terminal">
<pre>
          RAID Failure Points

        4-drive           6-drive
    ...............   ...............
F   R01   R10   prm   R01   R10   prm
----------------------------------------
0                1                 1
1                4                 6
2    4     2     6     9     3    15
3    4     4     4    18    12    20
4    1     1     1    15    15    15
5    -     -     -     6     6     6
6    -     -     -     1     1     1
</pre>
</div>
<p>It is my conclusion that the likelyhood of a catastrophic array failure is substantially greater for RAID 01 and prudence suggests a preference for RAID 10.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.redleopard.com/2009/01/raid-01-vs-raid-10/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
