#!/bin/sh
#DEVICE_LIST=""
DEVICE_LIST="/dev/sda /dev/sdb /dev/sdc /dev/sdd /dev/sde /dev/sdf /dev/sdg /dev/sdh /dev/sdi /dev/sdj /dev/sdk /dev/sdl /dev/sdm /dev/sdn"
for DEVICE in $DEVICE_LIST
do
echo "+++++create partition for $DEVICE......"
parted -s $DEVICE mklabel gpt mkpart gpt ext2 0% 100%
#PARTITION="$DEVICE""1"
PART="$DEVICE"
echo "+++++formatting $PART......"
mkfs.xfs -f -n ftype=1 $PART
done
cp /etc/fstab /etc/fstab.bak
PARTITION_LIST="sda sdb sdc sdd sde sdf sdg sdh sdi sdj sdk sdl sdm sdn"
for PARTITION in $PARTITION_LIST
do
UUID=`blkid "/dev/""$PARTITION" | awk '{print $2}' | sed 's/"//g'`
#UUID=`blkid "$PARTITION" | awk '{print $2}' | sed 's/"//g'`
echo $UUID
echo "add $PARTITION to /etc/fstab"
MOUNTDIR="/mnt/""$PARTITION"
echo "mkdir -p $MOUNTDIR"
mkdir -p $MOUNTDIR
echo "appending "$UUID $MOUNTDIR xfs defaults 0 0" to /etc/fstab "
echo "$UUID $MOUNTDIR xfs defaults 0 0" >> /etc/fstab
echo ""
done
#mount all partitions
mount -a
#show mounted partitions
df -h