#!/bin/bash #安装xfs文件系统相关包 rpm -ql xfsprogs || yum -y install xfsprogs #创建挂载目录 mkdir -p /data{1..16} j=1 #分区 for i in {b..m} do parted /dev/sd${i} <<ESXU mklabel gpt mkpart primary 0 -1 ignore quit ESXU sleep 1 #格式化挂载 mkfs.xfs -f /dev/sd${i}1 if [ "$?" = "0" ];then mount -o noatime,nodiratime,inode64,nobarrier /dev/sd${i}1 /data${j} echo "mount -o noatime,nodiratime,inode64,nobarrier /dev/sd${i}1 /data${j}" | tee -a /etc/rc.local fi let j+=1 done