#!/usr/bin/env bash

[ $# = 1 ] || {
	echo "SYNTAX: $0  <disk> (exp: sdb) ) "
	exit
}

disk=$1

mkdir -p  /data/disk/$disk
mkfs.ext4 /dev/$disk

UUID=`blkid  | grep $disk | awk -F\" '{print $2}'`
echo $disk UUID=$UUID

[ -z $UUID ] && {
	echo err UUID=$UUID
	exit
}

mount /dev/$disk /data/disk/$disk

echo  UUID=$UUID /data/disk/$disk ext4	defaults	0 	2 >> /etc/fstab
cat /etc/fstab
