[CentOS] Software Raid Recovery

Fri Feb 20 19:52:16 UTC 2009
Dan Carl <danc at bluestarshows.com>

Stephen Leonard Character wrote:
>> As posted early having swap on a raid zero is a bad idea .
>> Dan
>>     
>
>
> Yes I wasn't thinking too clearly when I made the swap raid0, well I did
> think about performance, but not drive failure :( 
>
> Thanks everyone for your help,
> Stephen
>
>   
I did the same thing when I started out using Linux.
At least you learned your lesson on a test box.

Here what I'd suggest.
Turn off the swap.
(Only because its a test box.
On the production server you'd want to create a new swap first.)
#swapoff /dev/md2
Umount the array
#umount /dev/md2
Then stop it
mdadm --stop /dev/md0

Create new swap now
I don't raid swap.
As stated in the Software Raid How-To
||"There's no reason to use RAID for swap performance reasons.
The kernel itself can stripe swapping on several devices, if you just 
give them the same priority in the |/etc/fstab| file."
Assuming you made your raid 0 over all four drives.
(never done this post install but I believe it would go like this)
go into fdisk and change partition type to 82
mkswap /dev/sda2
mkswap /dev/sdb2
mkswap /dev/sdc2
mkswap /dev/sdd2
Edit fstab file and give them the same priority
swapon -p 1 /dev/sda2
swapon -p 1 /dev/sdb2
swapon -p 1 /dev/sdc2
swapon -p 1 /dev/sdd2
and all should be good.