#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin
export PATH
i=1
while [ $i -lt 13 ]
do
j=`echo $i|awk '{printf "%c",97+$i}'`
fdisk /dev/sd$j <<ESXU
n
p
1
w
ESXU
echo "/n/n******/dev/sd${j} __was Fdisked! Waiting For 10 Second*****/n/n"
sleep 2s
mkfs.ext4 /dev/sd${j}1
if [ "$?" = "0" ];then
echo "/n/n*****sd${j}1 _________________was Formated, Waiting For 5 Second****/n/n"
fi
sleep 2s
mkdir /mnt/$i
tune2fs -c -1 -i 0 /dev/sd${j}1
mount /dev/sd${j}1 /mnt/$i
echo "/dev/sd${j}1 /mnt/$i ext4 defaults 0 0" >>/etc/fstab
let i+=1
done
转载于:https://my.oschina.net/davisqi/blog/292580