#!/bin/bash##About this Scripts infomationecho -e "\t\t#********************************************"echo -e "\t\t# ScriptName: disk.sh                       #"echo -e "\t\t# Author: Bai Shuming                       #"echo -e "\t\t# Create Date: 2013-05-18                   #"echo -e "\t\t# Modify Author:                            #"echo -e "\t\t# Modify Date:                              #"echo -e "\t\t# Function:                                 #"echo -e "\t\t# Blog: biying.blog.51cto.com               #"echo -e "\t\t#********************************************"#set variablePATH=`echo $PATH`ID=`id |awk '{print $1}'|cut -b5`FDISK="/sbin/fdisk"COUNT=`cat disk.list|wc -l`#CHECK OS SETUPif [ $ID -ne 0 ]   then        echo "need root user"        exit 10fiif [ ! -e $FDISK ]   then        echo "no found fdisk command"fi#set partition via fdisk commandfdisk -l |grep 'Disk'|awk '{print $2}'|cut -b8 > disk.listfor i in `cat disk.list`do  if [ ! -e /dev/sd$i[1-4] ] then               DISK=/dev/sd$i       fdisk $DISK   << EOFnp1tfdwEOFfidone#Set Raid 5mdadm -C /dev/md5 -l5 -n4 /dev/sd[b,c,d,e]1echo "DEVICE /dev/sdb1 /dev/sdc1 /dev/sdd1 /dev/sde1" > /etc/mdadm.confmdadm -D  -s >> /etc/mdadm.conf#Set lvmpvcreate /dev/md5vgcreate vfast /dev/md5#Clean tmp filerm -f disk.list##echo "disk setup OK"exit 0