Skip to content

Instantly share code, notes, and snippets.

@airawat airawat/mkfser.sh
Created Dec 4, 2017

Embed
What would you like to do?
#!/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
You can’t perform that action at this time.