[CentOS] Software Raid Recovery

Fri Feb 20 17:36:56 UTC 2009
Dan Carl <danc at bluestarshows.com>

Stephen Leonard Character wrote:
> On Fri, Feb 20, 2009 at 3:15 PM, Stephen Leonard Character
> <Stephen.Character at alorica.net> wrote:
>   
>> I have a server set up with 4hdd using software raid. I have /boot on
>>     
> a
>   
>> raid1 on md0 , / on raid5 on md1, and swap on raid0 on md2. If one of
>>     
> my
>   
>> drives die, how to I recover?
>>     
>
>   
>> First, put the swap also on RAID1, you don't want part of your memory
>> to become unavailable is a drive dies. Using RAID has no use then.
>>     
>
>   
>> If a drive dies nothing will happen, your system will continue to keep
>> running (if you put your swap on raid1 that is). But make sure you
>> configure mdadm to send you a mail when that happens, so you know a
>> drive is gone.
>>     
>
>   
>> For recovery, just replace the disk, repartition it and re-add the
>> partitions to the raid arrays and your are done. The disks will resync
>> and then everything is back to how it was.
>>     
>
>   
>> Regards,
>> Tim
>>     
>
> Thanks for the reply's, I'm assuming to do the repartitioning with fdisk
> or gparted to repartition, what tools do I use to manage the software
> raid? I.e. how do I go about changing the swap partition to raid1 and
> re-add the partitions to the array? This system is for me to practice on
> for my RHCT/E exams(too broke to pay for training) so I'm planning on
> breaking one of the drives(just remove it) and add a new one for
> practice.
>
> Thanks in advance,
> Stephen
>
>   
Right, first partition the new drive then add it back to the Raid like this.
mdadm /dev/md1 -a /dev/sdc3
Then the raid will start rebuilding.
As posted early having swap on a raid zero is a bad idea .
Dan