# bash createDisk.sh -PARTITION sdb -MOUNT /data_disk 
# PARTITION from fdisk -l
set -x
while [ $# -gt 0 ]; do
  COMMAND=$1
  case $COMMAND in
    -PARTITION)
      PARTITION=$2
      shift 2
      ;;
    -MOUNT)
      MOUNT=$2
      shift 2
      ;;
    *)
      break
      ;;
  esac
done

device="/dev/$PARTITION"
fileSystem="ext4"

parted -s $device mklabel gpt
parted $device mkpart primary $fileSystem 0% 100%
parted $device quit
mkdir -p $MOUNT
mkfs.ext4 ${device}1
echo "${device}1 ${MOUNT} ext4 defaults 0 0" >> /etc/fstab
mount -a