#!/bin/bash r1=`df -h |grep "/dev/vdb1"|wc -l ` r2=`fdisk -l|grep vdb1|wc -l ` if [ ${r1} -eq 1 ];then echo 1 exit fi if [ ${r2} -eq 1 ];then echo 2 exit fi echo "n p 1 w " | fdisk /dev/vdb && mkfs.ext4 /dev/vdb1 && mount /dev/vdb1 /data && echo "/dev/vdb1 /data ext4 defaults 0 0" >>/etc/fstab