--- /dev/null
+#!/bin/sh
+
+if [ -f recreate_raid_arrays ];then
+rm recreate_raid_arrays
+fi
+
+if [ -f findraidtemp ];then
+rm findraidtemp
+fi
+devices=""
+
+cat /proc/mdstat |grep active|grep -v inactive>>/dev/null
+ if [ $? = 0 ];then
+ cat /proc/mdstat |grep active|grep -v inactive>>findraidtemp
+ cat findraidtemp |while read line ;do
+ words=`echo $line |wc -w`
+ for i in `seq 1 $words`;do
+ a=1
+ result=`echo $line|cut -d" " -f$i`
+ res=`echo $result|cut -c1`
+ resu=`echo $result|cut -c 1-4`
+ resfin=`echo $result|tail -c2`
+ if [ "$res" = "m" ];then
+ device=$result
+
+ fi
+ if [ "$resu" = "raid" ];then
+ level=`echo $result|tail -c2`
+
+ fi
+ if [ "$resfin" = "]" ];then
+ dev=`echo $result |cut -d"[" -f1`
+ dev=`echo "/dev/"$dev" "`
+ devices=$devices$dev
+
+
+
+ fi
+ done
+ numdev=`echo $devices|wc -w`
+ onedev=`echo $devices|cut -d" " -f1`
+ uuid=`blkid |grep $onedev|cut -d'"' -f2`
+ echo "mdadm --create /dev/"$device" --level="$level" --raid-devices="$numdev " " $devices "--uuid="$uuid >>recreate_raid_arrays
+ devices=""
+ done
+chmod +x recreate_raid_arrays
+
+ fi
+ if [ -f findraidtemp ];then
+rm findraidtemp
+fi