1 #!/bin/bash 2 if fdisk -l|grep ‘/dev/sdb‘ > /dev/null 2>&1 ;then 3 fdisk /dev/sdb && mkfs.xfs /dev/sdb1 && echo "/dev/sdb1 /data xfs defaults 0 0" >> /etc/fstab && mkdir /data && mount -a 4 if [[ $? -ne 0 ]];then 5 echo "mount fail" 6 fi 7 else 8 echo "sdb not exist" 9 10 fi
原文:https://www.cnblogs.com/zhj5551/p/11198245.html