#!/bin/bash

modedata=($(/opt/tool/saturn-get-mode.sh))
num=${modedata[0]}
disks=${modedata[@]:1:${num}}

for d in ${disks[@]};do
    ret=$(lsblk -f | egrep "${d}.*ext4")
    if [ -n "$ret" ];then
	echo "Error:File system already exists"
	exit
    fi
done

systemctl stop glusterd minio minio-colony tgtd smb nfs-server
umount /dev/md5

echo "y" | mkfs.ext4 /dev/md5
sleep 3
/opt/tool/saturn-mount.py --raid

if [ -n "$(df -Th | grep /dev/md5)" ];then
    echo "success"
else
    echo "Error:/dev/md5 mount failed"
fi	

