适合每个磁盘大于2T磁盘挂载
#!/bin/bash
###适合每个磁盘大于2T磁盘挂载###
PATH=/bin:/sbin:/usr/bin:/usr/sbin
export PATH
N=`fdisk -l|grep /dev|grep Disk|tail -n +2|wc -l` --根据现场情况编写N变量
i=1
while [ $i -le $N]
do
mkdir -p /data/data${i}
j=`echo $i|awk '{printf "%c",97+$i}'`
parted /dev/sd${j} mktable gpt
parted /dev/sd${j}<<FORMAT
mkpart primary ext4 1MB -1
print
quit
FORMAT
echo "/n/n******/dev/sd${j} was Fopted!*****/n/n"
sleep 1
mkfs.ext4 /dev/sd${j}1
MOUNT="/dev/sd${j}1 /data/data${j} ext4 noatime,defaults 1 1"
echo $MOUNT >>/etc/fstab
let i+=1
sleep 1s
done
mount -a
df -h
适合每个磁盘小于2T磁盘挂载
#!/bin/bash
###适合每个磁盘小于2T磁盘挂载###
PATH=/bin:/sbin:/usr/bin:/usr/sbin
export PATH
N=`fdisk -l|grep /dev|grep Disk|tail -n +2|wc -l` --根据现场情况编写N变量
i=1
while [ $i -le $N]
do
mkdir -p /data/data${i}
j=`echo $i|awk '{printf "%c",97+$i}'`
fdisk /dev/sd$j <<ESXU
n
p
1
w
ESXU
echo "/n/n******/dev/sd${j} was Fopted!*****/n/n"
sleep 1
mkfs.ext4 /dev/sd${j}1
MOUNT="/dev/sd${j}1 /data/data${j} ext4 noatime,defaults 1 1"
echo $MOUNT >>/etc/fstab
let i+=1
sleep 1s
done
mount -a
df -h