parted分区脚本

#!/bin/bash  
#Used to fomat 6 disks
PATH=/bin:/sbin:/usr/bin:/usr/sbin
export PATH  
disk_to_parted="$1"
if [ $# == 0 ];then
    echo "no disk to parted,example /dev/sdb"
    exit
else
    echo "/n/n****** ${disk_to_parted} __was Fdisked! Waiting For 3 Second*****/n/n"
fi
/sbin/parted ${disk_to_parted} <<ESXU
     mklabel gpt
     mkpart primary 0 -1
     ignore
     quit
ESXU
sleep 3s
/sbin/mkfs.ext4 ${disk_to_parted}1
if [ "$?" = "0" ];then
   echo "/n/n*****${disk_to_parted}1 _________________was Formated, Waiting For 1 Second****/n/n"
fi
/sbin/blkid ${disk_to_parted}1
sleep 1s

猜你喜欢

转载自www.cnblogs.com/kaishirenshi/p/10249052.html