<?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>Kevin Deldycke &#187; mdadm</title> <atom:link href="http://kevin.deldycke.com/tag/mdadm/feed/" rel="self" type="application/rss+xml" /><link>http://kevin.deldycke.com</link> <description>Free software engineer &#38; wannabe videomaker</description> <lastBuildDate>Fri, 03 Feb 2012 19:08:27 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.1</generator> <item><title>Heroic journey to RAID-5 data recovery</title><link>http://kevin.deldycke.com/2008/07/heroic-journey-to-raid-5-data-recovery/</link> <comments>http://kevin.deldycke.com/2008/07/heroic-journey-to-raid-5-data-recovery/#comments</comments> <pubDate>Thu, 24 Jul 2008 21:20:27 +0000</pubDate> <dc:creator>Kev</dc:creator> <category><![CDATA[English]]></category> <category><![CDATA[array]]></category> <category><![CDATA[Backup]]></category> <category><![CDATA[disk]]></category> <category><![CDATA[drive]]></category> <category><![CDATA[Hardware]]></category> <category><![CDATA[HDD]]></category> <category><![CDATA[Linux]]></category> <category><![CDATA[mdadm]]></category> <category><![CDATA[monitoring]]></category> <category><![CDATA[RAID]]></category> <category><![CDATA[Server]]></category> <category><![CDATA[system]]></category> <category><![CDATA[UPS]]></category><guid isPermaLink="false">http://kevin.deldycke.com/?p=246</guid> <description><![CDATA[Last week there was a power grid failure which break down my server&#8217;s RAID array. I have no UPS (as I&#8217;m a skinflint) and no automatic email alerts (because I&#8217;m too lazy to set it up). As a result, for &#8230; <a href="http://kevin.deldycke.com/2008/07/heroic-journey-to-raid-5-data-recovery/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description> <content:encoded><![CDATA[<p>Last week there was a power grid failure which break down my server&#8217;s RAID array. I have no <a href="http://en.wikipedia.org/wiki/Uninterruptible_power_supply">UPS</a> (as I&#8217;m a skinflint) and no automatic email alerts (because I&#8217;m too lazy to set it up). As a result, for 5 days, my 3-disk <a href="http://en.wikipedia.org/wiki/RAID_5">RAID-5 array</a> was relying on only 2 disks until I noticed the issue&#8230;</p><p>By using a combination of following commands, I was soon aware of the gravity of the situation:</p><pre class="brush: bash; title: ; notranslate">
cat /proc/mdstat
mdadm --examine /dev/sda1
</pre><p>My <code>/dev/sda1</code> disk was kicked out of the array, so I did the right stuff which consisted of reconstructing the array:</p><pre class="brush: bash; title: ; notranslate">
mdadm /dev/md0 -a /dev/sda1
</pre><p>Then, in an unlucky combination of cosmic ray bombardment, spooky action at a distance and astrological misalignment, half-way to the end of the rebuilding process (which can take up to 5 hours), another disk failed ! It was late, I was tired and utterly worried about losing 1.5 To of precious data. In such a bad shape, I was afraid to worsen the situation. So I decided to shutdown the server and sleep on the problem.</p><p>The next day I tried to boot my server to find it (surprise !) stuck in the middle of the boot process, with the famous message:</p><pre class="brush: bash; title: ; notranslate">
hit control-D to continue or give root password to fix manually
</pre><p>This is &#8220;normal&#8221; as my server tried to mount the <a href="http://en.wikipedia.org/wiki/Ext3">ext3 filesystem</a> from the <code>/dev/md0</code> partition that was just assembled by <code>mdadm</code>. Of course <code>md0</code>, if assembled and available to the system, was not running because only one disk, out of three, was in a clean state.</p><p>I skip here the epic substory in which I wasted days in a search of a working keyboard, but I let you imagine how such adventures makes my week&#8230;</p><p>Eventually, I was able to analyze the situation in details. My first reflex ? Check that disks are not physically dead:</p><pre class="brush: bash; title: ; notranslate">
fdisk -l /dev/sda
fdisk -l /dev/sdb
fdisk -l /dev/sdc
</pre><p>&#8220;Linux raid partitions&#8221; (type code &#8220;<code>fd</code>&#8220;) are still there. Good. I assumed here that disks where not physically damaged. Maybe I should have looked at <a href="http://en.wikipedia.org/wiki/Self-Monitoring,_Analysis,_and_Reporting_Technology">S.M.A.R.T.</a> datas and statistics (via <a href="http://smartmontools.sourceforge.net">smartmontools</a>). But remember, I&#8217;m lazy (and a bit crazy).</p><p>The next step was to get informations about the RAID array itself using:</p><pre class="brush: bash; title: ; notranslate">
mdadm --detail /dev/md0
</pre><p>which output the status table below (probably inaccurate as I reconstructed it afterwards):</p><pre class="brush: bash; title: ; notranslate">
Number   Major   Minor   RaidDevice State
   0       0        0        0      removed
   1       0        0        1      faulty removed
   2       8       33        2      active sync   /dev/sdc1
   3       8       17        3      spare
</pre><p>What this table told us ?</p><ul><li>The array is up, but not running. One of its device (<code>sdc1</code>) was clean and active, but it&#8217;s not enough to get a working RAID-5.</li><li>My first attempt to rebuild the array lead to an unexpected result: it added <code>sda1</code> as a spare device (in slot #3).</li><li>It confirm that <code>sdb1</code> unexpectedly failed and is now in a bad state (&#8220;<code>faulty removed</code>&#8220;).</li></ul><p>Then I stopped the array and tried to fearlessly (re)assemble it using 3 differents methods:</p><pre class="brush: bash; title: ; notranslate">
mdadm -S /dev/md0
mdadm -A /dev/md0
mdadm --assemble /dev/md0 --verbose /dev/sd[abc]1
mdadm --assemble --force --scan /dev/md0 --verbose
</pre><p>It always failed with messages like:</p><pre class="brush: bash; title: ; notranslate">
mdadm: failed to RUN_ARRAY /dev/md0: Input/output error
mdadm: /dev/md0 assembled from 1 drives and 1 spare - not enough to start the array.
</pre><p>So I examined each drive from <code>mdadm</code>&#8216;s point of view:</p><pre class="brush: bash; title: ; notranslate">
mdadm -E /dev/sda1
mdadm -E /dev/sdb1
mdadm -E /dev/sdc1
mdadm -E /dev/sd[abc]1 | grep Event
</pre><p>The lastest command compare the &#8220;<code>Event</code>&#8221; attribute of all devices. It output something like:</p><pre class="brush: bash; title: ; notranslate">
Events : 0.53120
Events : 0.53108
Events : 0.53120
</pre><p>which indicate that <code>sda1</code> and <code>sdc1</code> are somewhat synced (share the same number) and <code>sdb1</code> &#8220;late&#8221; (lower number).</p><p>Here I&#8217;ve got the idea of recreating the raid array without <code>sdb1</code>, relying only on <code>sda1</code> and <code>sdc1</code>, by using the &#8220;magic&#8221; (hence dangerous) <code>--assume-clean</code> option. The latter doesn&#8217;t build, erase or initialize a new array. It just try to assemble it &#8220;as is&#8221;. Here is the command:</p><pre class="brush: bash; title: ; notranslate">
mdadm --create /dev/md0 --assume-clean --level=5 --verbose --raid-devices=3 /dev/sda1 missing /dev/sdc1
</pre><p>And it worked ! <img src='http://kevin.deldycke.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /></p><p>I mounted the <code>md0</code> partition and cleaned it up:</p><pre class="brush: bash; title: ; notranslate">
fsck.ext3 -v /dev/md0
mount /dev/md0
</pre><p>I updated my <a href="http://neil.brown.name/blog/mdadm">mdadm</a> configuration before rebooting my server:</p><pre class="brush: bash; title: ; notranslate">
mdadm --detail --scan &gt;&gt; /etc/mdadm/mdadm.conf
vi /etc/mdadm/mdadm.conf
reboot
</pre><p>But history repeat itself, and again, the system hang up during boot. Except this time I knew what was happening: the boot process detected the remaining <code>sdb1</code> device as part of the old array (the one before the regeneration I did above) and tried to run it. <a href="http://kevin.deldycke.com/2007/03/how-to-recover-a-raid-array-after-having-zero-ized-superblocks/">Remembering my last year post</a>, I zero-ized the superblock of <code>sdb1</code>:</p><pre class="brush: bash; title: ; notranslate">
mdadm -S /dev/md0
mdadm --zero-superblock /dev/sdb1
</pre><p>A server reboot proved I was right and my <code>md0</code> partition was automagically mounted in altered state:</p><pre class="brush: bash; title: ; notranslate">
localhost:~# cat /proc/mdstat
Personalities : [raid6] [raid5] [raid4]
md0 : active raid5 sdb1[3] sda1[0] sdc1[2]
      1465143808 blocks level 5, 64k chunk, algorithm 2 [3/2] [U_U]

unused devices: &lt;none&gt;
</pre><p>I just had to re-add <code>sdb1</code> to fill the available slot and update the mdadm configuration to get back my array in its initial state:</p><pre class="brush: bash; title: ; notranslate">
mdadm --manage /dev/md0 --add /dev/sdb1
mdadm --detail --scan &gt;&gt; /etc/mdadm/mdadm.conf
vi /etc/mdadm/mdadm.conf
</pre>]]></content:encoded> <wfw:commentRss>http://kevin.deldycke.com/2008/07/heroic-journey-to-raid-5-data-recovery/feed/</wfw:commentRss> <slash:comments>10</slash:comments> </item> <item><title>How-to Recover a RAID array after having Zero-ized Superblocks</title><link>http://kevin.deldycke.com/2007/03/how-to-recover-a-raid-array-after-having-zero-ized-superblocks/</link> <comments>http://kevin.deldycke.com/2007/03/how-to-recover-a-raid-array-after-having-zero-ized-superblocks/#comments</comments> <pubDate>Wed, 07 Mar 2007 21:48:52 +0000</pubDate> <dc:creator>Kev</dc:creator> <category><![CDATA[English]]></category> <category><![CDATA[Backup]]></category> <category><![CDATA[Hardware]]></category> <category><![CDATA[Linux]]></category> <category><![CDATA[mdadm]]></category> <category><![CDATA[RAID]]></category> <category><![CDATA[Server]]></category><guid isPermaLink="false">http://kevin.deldycke.com/2007/03/how-to-recover-a-raid-array-after-having-zero-ized-superblocks/</guid> <description><![CDATA[Today mdadm send me a mail to warn that one of my hard drive (/dev/hdd1) was ejected from my RAID-5 array. After some manipulations (no writes, just reads on the file system to get informations) and reboots, I ended up &#8230; <a href="http://kevin.deldycke.com/2007/03/how-to-recover-a-raid-array-after-having-zero-ized-superblocks/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description> <content:encoded><![CDATA[<p>Today <code>mdadm</code> send me a mail to warn that one of my hard drive (<code>/dev/hdd1</code>) was ejected from my RAID-5 array. After some manipulations (no writes, just reads on the file system to get informations) and reboots, I ended up with a file system in a strange state: the folder structure was totally messed up and lots of files disappeared.</p><p>Assuming that this situation was about an inconsistent file index, I decided to reset the superblocks of the remaining physical disks:</p><pre class="brush: bash; title: ; notranslate">
mdadm --zero-superblock /dev/hdc1
mdadm --zero-superblock /dev/hdb1
</pre><p>I don&#8217;t know why I decided to do so, but it was the stupidest idea of the week. After such a violent treatment, my array refused to start:</p><pre class="brush: bash; title: ; notranslate">
[root@localhost ~]$ mdadm --assemble /dev/md0 --auto --scan --update=summaries --verbose
mdadm: looking for devices for /dev/md0
mdadm: no RAID superblock on /dev/hdc1
mdadm: /dev/hdc1 has wrong raid level.
mdadm: no RAID superblock on /dev/hdb1
mdadm: /dev/hdb1 has wrong raid level.
mdadm: no devices found for /dev/md0
</pre><p>At this moment I was sure that all my data assets were lost. I was desperate. My only alternative was to ask Google. So I did.</p><p>I spend several minutes browsing the web without hope. I finally found <a href="http://lists.debian.org/debian-user-french/2006/03/msg00602.html">someone in the same situation as mine</a> (sorry, in french) on debian-user-french mailing list.</p><p>The solution was to recreate the RAID array. This sound counter-intuitive: if we recreate a raid array over an existing one, it will be erased ! Right ? Wrong ! <a href="http://lists.debian.org/debian-user-french/2006/03/msg00607.html">As it is said on debian-user-french</a>, <code>mdadm</code> is smart enough to &#8220;see&#8221; that HDD of the new array were elements of a previous one. Knowing that, <code>mdadm</code> will try to do its best (i.e. if parameters match the previous array configuration) and rebuild the new array upon the previous one in a non-destructive way, by keeping HDD content.</p><p>So, here is how I finally recovered my RAID array:</p><pre class="brush: bash; title: ; notranslate">
[root@localhost ~]$ mdadm --create /dev/md0 --verbose --level=5 --raid-devices=3 /dev/hdc1 missing /dev/hdb1
mdadm: layout defaults to left-symmetric
mdadm: chunk size defaults to 64K
mdadm: size set to 312568576K
mdadm: array /dev/md0 started.
</pre><p>Of course this doesn&#8217;t solve my initial problem about the <code>/dev/md0</code> file system: it is still in an altered state. Maybe it&#8217;s too late to recover data. But at least I reverted all my today&#8217;s mistakes, and the situation will not deteriorate until I power up my RAID ! <img src='http://kevin.deldycke.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /></p> ]]></content:encoded> <wfw:commentRss>http://kevin.deldycke.com/2007/03/how-to-recover-a-raid-array-after-having-zero-ized-superblocks/feed/</wfw:commentRss> <slash:comments>34</slash:comments> </item> <item><title>Créer un Espace de Stockage Fiable avec RAID 5 et LVM sous Linux</title><link>http://kevin.deldycke.com/2005/04/creer-un-espace-de-stockage-fiable-avec-raid-5-et-lvm-sous-linux/</link> <comments>http://kevin.deldycke.com/2005/04/creer-un-espace-de-stockage-fiable-avec-raid-5-et-lvm-sous-linux/#comments</comments> <pubDate>Mon, 18 Apr 2005 22:24:44 +0000</pubDate> <dc:creator>Kev</dc:creator> <category><![CDATA[Français]]></category> <category><![CDATA[Backup]]></category> <category><![CDATA[boitier externe]]></category> <category><![CDATA[CLI]]></category> <category><![CDATA[disque dur]]></category> <category><![CDATA[firewire]]></category> <category><![CDATA[Hardware]]></category> <category><![CDATA[informatique]]></category> <category><![CDATA[Linux]]></category> <category><![CDATA[LVM]]></category> <category><![CDATA[Mandriva]]></category> <category><![CDATA[mdadm]]></category> <category><![CDATA[openbrick]]></category> <category><![CDATA[ordinateur]]></category> <category><![CDATA[RAID]]></category> <category><![CDATA[USB]]></category> <category><![CDATA[XFS]]></category><guid isPermaLink="false">http://kevin.deldycke.com/2005/04/creer-un-espace-de-stockage-fiable-avec-raid-5-et-lvm-sous-linux/</guid> <description><![CDATA[Cet article explique comment créer un espace de stockage redondant et fiable en utilisant du matériel grand public et bon marché. Cela est possible par la combinaison de Linux, des mécanismes RAID logiciel et du gestionnaire de volumes logiques LVM. &#8230; <a href="http://kevin.deldycke.com/2005/04/creer-un-espace-de-stockage-fiable-avec-raid-5-et-lvm-sous-linux/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description> <content:encoded><![CDATA[<p>Cet article explique comment créer un espace de stockage redondant et fiable en utilisant du matériel grand public et bon marché. Cela est possible par la combinaison de Linux, des mécanismes RAID logiciel et du gestionnaire de volumes logiques LVM.</p><p><em><strong>Mise à jour</strong>: Le but initial était d&#8217;utiliser des boîtiers externes USB pour construire une matrice RAID. En réalité je n&#8217;ai jamais pu obtenir de résultats convaincants car les disques USB ne sont pas aussi fiables que des disques dur IDE classique. Je m&#8217;explique: une partie seulement des instructions IDE trouvent leurs équivalents dans le protocole USB, limitant ainsi l&#8217;accès bas niveau aux disques durs externes par le kernel linux. Voila pourquoi cet article reste inachevé et que certaines parties ci-dessous peuvent paraître décousues.</em></p><p>Pour commencer une <a href="http://fr.wikipedia.org/wiki/RAID_%28informatique%29">explication de la technologie RAID</a> et de ses intérêts n&#8217;est pas superflu.</p><p>Je dispose de 2 disques durs de 120 Go, que je met chacun dans un boîtier externe USB 2. Je les branche ensuite sur mon <a href="http://web.archive.org/web/20060822232700/http://www.storever.com/product/openbrick/openbrick-ng">OpenBrick NG</a> qui possède sur son port IDE0 un disque dur de 160 Go qui héberge l&#8217;OS. L&#8217;OS en question est une Mandrakelinux 10.0 installée sur les 40 premiers gigas du disque IDE, dans des partitions classiques qui ne seront pas protégées par le RAID. J&#8217;ai choisi une Mandrakelinux 10.0 car à l&#8217;époque la Mandriva 2005 n&#8217;était pas encore disponible et la Mandrake 10.1 à un <code>udev</code> buggé qui ne créée pas les devices RAID (donc impossibilité d&#8217;activer automatiquement le RAID au démarrage).</p><p>Supposons à partir de maintenant que l&#8217;OS est installé, pour nous concentrer uniquement sur la configuration et la mise en route du RAID.</p><h2>Étape 1: Formater les partitions</h2><p>J&#8217;ai donc les devices suivants:</p><ul><li><code>/dev/hda</code> -> DD de 160 Go (40 Go pour l&#8217;OS et 120 Go de libre)</li><li><code>/dev/sda</code> -> DD externe de 120 Go n°1</li><li><code>/dev/sdb</code> -> DD externe de 120 Go n°2</li></ul><p>Nous voulons créer une matrice RAID 5 à partir de 3 x 120 Go. Plutôt que de faire une seule grosse partition de 120 Go par disque, nous allons créer dans chacun des disques trois partitions de 40 Go (3 x 3 x 40 Go = 3 x 120 Go). Nous construirons ensuite 3 unités RAID 5 de 3 x 40 Go puis nous les assemblerons via LVM. L&#8217;intérêt de diviser nos grosses partitions en plus petites est de réduire considérablement (par un facteur 3 dans notre cas) le temps de régénération de nos unités RAID en cas de corruption d&#8217;une partition.</p><p>Les partitions à créer sont de type Linux RAID. On pourra éventuellement faire cela avec <code>drakconf</code>.</p><h2>Étape 2: Configuration de la matrice RAID</h2><p>Nous utiliserons <code>mdadm</code> pour la gestion de notre RAID.</p><p><u>Note</u>: A partir de la 10.1, la version de <code>webmin</code> fournie avec la Mandrake supporte <code>mdadm</code>. Pour arriver à nos fins par ce moyen, on pourras s&#8217;inspirer d&#8217;un <a href="http://froverio.online.fr/articles.php?lng=fr&#038;pg=55">article sur la mise en place d&#8217;un RAID via webmin</a>.</p><p>Installation de mdadm:</p><pre class="brush: bash; title: ; notranslate">
urpmi mdadm
</pre><p>Création des matrices:</p><pre class="brush: bash; title: ; notranslate">
mdadm --create --verbose /dev/md0 --level=5 --raid-devices=3 /dev/hda2 /dev/sda2 /dev/sdb2
mdadm --create --verbose /dev/md1 --level=5 --raid-devices=3 /dev/hda3 /dev/sda1 /dev/sdb1
mdadm --create --verbose /dev/md2 --level=5 --raid-devices=3 /dev/hda4 /dev/sda3 /dev/sdb3
</pre><p>Lors de la création, les paramètres par défaut sont suffisants. Pour information, les paramètres optimaux sont:</p><ul><li>Parity: left symetric</li><li>Persistent super block</li><li>Chunk size: 32kb ou 64kb (pour nos partitions de 40 Go)</li></ul><p>Éditons le fichier de configuration <code>/etc/mdadm.conf</code>:</p><pre class="brush: bash; title: ; notranslate">
DEVICE          /dev/sda*
DEVICE          /dev/sdb*
DEVICE          /dev/hda2
DEVICE          /dev/hda3
DEVICE          /dev/hda4
ARRAY           /dev/md0 devices=/dev/hda2,/dev/sda2,/dev/sdb2
ARRAY           /dev/md1 devices=/dev/hda3,/dev/sda1,/dev/sdb1
ARRAY           /dev/md2 devices=/dev/hda4,/dev/sda3,/dev/sdb3
</pre><p>Avant d&#8217;aller plus loin, il faut attendre que les matrices soient construites:</p><pre class="brush: bash; title: ; notranslate">
watch -n1 'cat /proc/mdstat'
</pre><p>Dans mon cas, cela à nécessité entre deux et trois heures pour chaque unité RAID.</p><p><u>Note</u>: avec la Mandrake 10.1, lors de la création des matrices RAID, on aurait eu des problèmes du type <code>raidstart failed : /dev/md1: No such file or directory</code>, qui peuvent être résolus en créant les device manuellement:</p><pre class="brush: bash; title: ; notranslate">
mknod /dev/md0 b 9 0
mknod /dev/md1 b 9 1
mknod /dev/md2 b 9 2
</pre><p>Ces commandes créent les unités RAID dont nous avons besoin. Malheureusement elles ne sont pas autodetectées au démarrage donc, dans le cas d&#8217;une mdk 10.1, il aurait fallu faire cette manip à chaque démarrage de la machine. Voila une bonne raison pour ne pas utiliser la version 10.1.</p><h2>Étape 3: Agréger les matrices RAID via LVM</h2><p>J&#8217;ai choisi LVM pour agréger les unités RAID, pour bénéficier d&#8217;un redimensionnement flexible de mon espace disque, avant de parer à tous les scénarios possibles auxquels je serais confronté dans le futur. Il est tout à fait possible de faire la même chose avec du RAID linéaire (voir l&#8217;étape &#8220;3-bis&#8221; ci-après), mais dans ce cas on perd la une certaine souplesse au niveau des partitions.</p><p>Installation de LVM:</p><pre class="brush: bash; title: ; notranslate">
urpmi lvm2
</pre><p>On peut consulter la liste des disques parents sur le système avec <code>lvmdiskscan</code>.</p><p>Ensuite il faut créer un volume physique (PV = Physical Volume) pour chaque unité RAID:</p><pre class="brush: bash; title: ; notranslate">
pvcreate /dev/md0
pvcreate /dev/md1
pvcreate /dev/md2
</pre><p>Créons maintenant un groupe de volumes contenant nos trois partitions :</p><pre class="brush: bash; title: ; notranslate">
vgcreate vg01 /dev/md0 /dev/md1 /dev/md2
</pre><p>(marche pas ???)</p><h2>Étape 3-bis: Agréger les matrices avec du RAID linéaire au lieu d&#8217;utiliser LVM</h2><p>Si vous voulez utiliser du RAID linéaire plutôt que LVM, il faut créer une nouvelle unité RAID sur la base des trois premières:</p><pre class="brush: bash; title: ; notranslate">
mdadm --create --verbose /dev/md3 --level=linear --raid-devices=3 /dev/md0 /dev/md1 /dev/md2
</pre><p>Puis penser à mettre à jour <code>/etc/mdadm.conf</code>:</p><pre class="brush: bash; title: ; notranslate">
DEVICE          /dev/sda*
DEVICE          /dev/sdb*
DEVICE          /dev/hda2
DEVICE          /dev/hda3
DEVICE          /dev/hda4
DEVICE          /dev/md0
DEVICE          /dev/md1
DEVICE          /dev/md2
ARRAY           /dev/md0 devices=/dev/hda2,/dev/sda2,/dev/sdb2
ARRAY           /dev/md1 devices=/dev/hda3,/dev/sda1,/dev/sdb1
ARRAY           /dev/md2 devices=/dev/hda4,/dev/sda3,/dev/sdb3
ARRAY           /dev/md3 devices=/dev/md0,/dev/md1,/dev/md2
</pre><h2>Étape 4: Créer le système de fichier</h2><p>Formater en xfs:</p><pre class="brush: bash; title: ; notranslate">
mkfs.xfs -f /dev/md3
</pre><p>J&#8217;ai choisi xfs comme filesystem car il peut être agrandit à chaud, lorsque la partition est montée.</p><p>Pour monter le tout:</p><pre class="brush: bash; title: ; notranslate">
mkdir -p /mnt/data
mount /dev/md3 /mnt/data
</pre><p>Et enfin, pour le montage automatique au démarrage de notre serveur, il faut ajouter la ligne suivante à notre fichier <code>/etc/fstab</code>:</p><pre class="brush: bash; title: ; notranslate">
/dev/md3 /mnt/data xfs defaults 0 0
</pre><h2>Maintenance du système</h2><ul><li>Réintégrer une partition dans la matrice.<p>Si une partition est éjectée d&#8217;une unité raid (par exemple <code>sda1</code> sur <code>md1</code>), il faut faire:</p><pre class="brush: bash; title: ; notranslate">
cat /proc/mdstat
mdadm --examine /dev/sda1
mdadm /dev/md1 -a /dev/sda1
cat /proc/mdstat
</pre><p>La première commande montre que le RAID est dégradé. La seconde commande examine le status du disque qui à été éjecté de la matrice. La troisième ligne permet de réintégrer à chaud la partition dans la matrice. Et enfin la dernière commande nous montre l&#8217;avancement de la reconstruction de la matrice (ce qui peut prendre pas mal de temps).</li><li>Ré-assembler une matrice.<p>La commande est du type:</p><pre class="brush: bash; title: ; notranslate">
mdadm --stop /dev/md0
mdadm --assemble /dev/md0
</pre><p>Attention <code>--assemble</code> se base sur le fichier <code>/etc/mdadm.conf</code>.</li><li>Créer une unité RAID dégradée.<p>La commande suivante créée une unité RAID 5 sur 3 disques durs, en indiquant que le premier est absent via le mot clé <code>missing</code>:</p><pre class="brush: bash; title: ; notranslate">
mdadm --create /dev/md0 --level=5 --raid-devices=3 missing /dev/hda1 /dev/sda1
</pre></li></ul><h2>De la lecture complémentaire sur RAID 5 et LVM</h2><ul><li><a href="http://www.ethics-gradient.net/myth/storage.html">Notes on Building a Linux Storage Server, by Martin Smith</a></li><li><a href="http://gentoo-wiki.com/HOWTO_Gentoo_Install_on_Software_RAID_mirror_and_LVM2_on_top_of_RAID">Gentoo Install on Software RAID mirror and LVM2 on top of RAID</a></li><li><a href="http://scottstuff.net/blog/articles/2005/01/10/disks-are-fun">Disks are fun</a></li><li><a href="http://scottstuff.net/blog/articles/2005/01/08/anatomy-of-a-drive-failure">Anatomy of a Drive Failure</a></li><li><a href="http://www.digitalmapping.sk.ca/Networks/ExpandingRAID.htm">Changing RAID Drives Without Losing Data</a></li></ul> ]]></content:encoded> <wfw:commentRss>http://kevin.deldycke.com/2005/04/creer-un-espace-de-stockage-fiable-avec-raid-5-et-lvm-sous-linux/feed/</wfw:commentRss> <slash:comments>6</slash:comments> </item> </channel> </rss>
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced
Database Caching 2/20 queries in 0.008 seconds using apc
Object Caching 721/764 objects using apc

Served from: kevin.deldycke.com @ 2012-02-08 10:07:35 -->
