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

 

posted @ 2019-01-10 11:39  开始认识  阅读(1942)  评论(0编辑  收藏  举报