当前位置:网站首页>The script implements the automated deployment of raid0

The script implements the automated deployment of raid0

2022-06-24 19:00:00 51CTO

#!/bin/bash

# Use EOF Realize automatic configuration raid0

#reid( Strip ) >=2 Improve reading and writing speed , disk IO performance No fault tolerance Disk utilization %100

read -p " Please enter the path of the disk you want to make " path

if [ -b $path ]

then

 echo " The device is a block device , Already exists "

 echo " Start automated partitioning "

fdisk $path <<EOF

n

p



+1G

n

p



+1G

p

t

1

fd

t

2

fd

p

w

EOF

sleep 3

mdadm -C -a yes /dev/md0 -l 0 -n 2 ${path}[12]

echo " see raid0 situation "

mdadm -D /dev/md0

echo " format partition "

mkfs.ext4 /dev/md0

read -p " Please enter the created mount point " bb

if [ -e $bb ]

then

 echo " Mount point already exists "

else

 echo " Create mount point "

 mkdir $bb

fi

 echo " Mount device "

 mount /dev/md0 $bb

 echo " see "

  df -h

else

 echo " Device does not exist , Please check and re-enter "


fi

原网站

版权声明
本文为[51CTO]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/175/202206241833133316.html