# 创建分区
[root@centos7 ~]# cat parted.sh
parted --script /dev/sdb \
mklabel gpt \
mkpart primary 1MiB 100GB \
mkpart primary 100GB 200GB \
mkpart primary 200GB 300GB \
mkpart primary 300GB 400GB \
mkpart primary 400GB 500GB \
mkpart primary 500GB 600GB \
mkpart primary 600GB 700GB \
mkpart primary 700GB 800GB \
mkpart primary 800GB 900GB \
mkpart primary 900GB 1000GB \
mkpart primary 1000GB 1100GB \
mkpart primary 1100GB 1200GB \
mkpart primary 1200GB 1300GB \
mkpart primary 1300GB 1400GB \
mkpart primary 1400GB 1500GB \
mkpart primary 1500GB 1600GB \
mkpart primary 1600GB 1700GB \
mkpart primary 1700GB 1800GB \
mkpart primary 1800GB 1900GB \
mkpart primary 1900GB 2000GB \
mkpart primary 2000GB 2100GB \
# 格式化磁盘分区,并挂载对应的目录
[root@centos7 ~]#
for i in {1..20}
do
mkdir /mnt/test$i
mkfs.xfs /dev/sdb$i -f
uuid=$(blkid /dev/sdb$i |awk '{print $2}' |awk -F '"' '{print $2}')
echo "UUID=$uuid /mnt/test$i xfs defaults 0 0" >> /etc/fstab
done