标签:xfs 磁盘分区脚本 gpt ati parted bsp format sda form
由于需要处理的硬盘太多,所做的重复操作太多,写成脚本parted.sh方便。
# /dev/sda|b|d|e|g|h|i|j|k|l 分别是10块硬盘,/dev/sdc 和 /dev/sdf 是用做 journal 的 SSD:
# vi parted.sh #!/bin/bash set -e if [ ! -x "/sbin/parted" ]; then echo "This script requires /sbin/parted to run!" >&2 exit 1 fi DISKS="a b d e g h i j k l" for i in ${DISKS}; do echo "Creating partitions on /dev/sd${i} ..." parted -a optimal --script /dev/sd${i} -- mktable gpt parted -a optimal --script /dev/sd${i} -- mkpart primary xfs 0% 100% sleep 1 #echo "Formatting /dev/sd${i}1 ..." mkfs.xfs -f /dev/sd${i}1 & done SSDS="c f" for i in ${SSDS}; do parted -s /dev/sd${i} mklabel gpt parted -s /dev/sd${i} mkpart primary 0% 20% parted -s /dev/sd${i} mkpart primary 21% 40% parted -s /dev/sd${i} mkpart primary 41% 60% parted -s /dev/sd${i} mkpart primary 61% 80% parted -s /dev/sd${i} mkpart primary 81% 100% done
标签:xfs 磁盘分区脚本 gpt ati parted bsp format sda form
原文地址:https://www.cnblogs.com/hcs88/p/11961905.html