Created
December 4, 2017 04:10
-
-
Save airawat/7631b57cdcf4426ac1d16ea0e2943ec3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
set -x | |
# create the input file based on size (you can get size pattern by running fdisk -l as root) | |
# Be sure to exclude the Root disk if it is part of your config. You must edit this file to do so | |
size=$1 | |
shift; | |
fdisk -l|grep $size|awk '{print $2}'|sed -e"s/\:$//g" > foo | |
count=`cat /root/foo|wc -l` | |
iterator=1; | |
while [ $iterator -lt $count ]; do | |
for i in `cat foo`; do | |
mpt=$iterator | |
mkdir -p /data/$mpt | |
umount /data/$mpt | |
mkfs.xfs -f $i | |
uuid=$(blkid $i |awk '{print $2}'|sed -e"s/UUID=\"//g"|sed -e"s/\"$//g") | |
echo "UUID=$uuid /data/$mpt xfs noatime,nodiratime,inode64 0 0" |tee -a /etc/fstab | |
mount /data/$mpt | |
iterator=$(($iterator + 1)) | |
done | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment