#!/usr/bin/env bash

#read -p "Please input you want format partition: " I

yum install -y vim expect

expect /usr/local/sbin/fdisk.pt
#expect /usr/local/sbin/fdisk.pt $I

mkfs -t ext4 /dev/xvdb1 > /dev/null

MOUNT_DIR=/data
if [ ! -d "$MOUNT_DIR" ] ;then
        mkdir $MOUNT_DIR
fi

Z=$(egrep $MOUNT_DIR /etc/fstab)
if [ -z "$Z" ] ;then
        echo "/dev/xvdb1              /data                      ext4   defaults  0  0" >> /etc/fstab
fi

mount /dev/xvdb1 /data

