#!/bin/bash

i=1

systemctl stop minio
systemctl stop nfs-server
systemctl stop smb
systemctl stop tgtd
systemctl stop glusterd

umount /opt/storage/data1
umount /opt/storage/data2
umount /opt/storage/data3
umount /opt/storage/data4

echo "y"|mkfs.ext4 /dev/sda1
echo "y"|mkfs.ext4 /dev/sdb1
echo "y"|mkfs.ext4 /dev/sdc1
echo "y"|mkfs.ext4 /dev/sdd1

sleep 3

while [ $i -le 3 ]
do
  bick=$(df |grep data|wc -l)

  if [ $bick -eq 4 ];then
     echo "break"
     break
  else
     echo "start------"
     mount /dev/sda1 /opt/storage/data1
     mount /dev/sdb1 /opt/storage/data2
     mount /dev/sdc1 /opt/storage/data3
     mount /dev/sdd1 /opt/storage/data4
     sleep 1
  fi
 let i++
done

echo "success"

