shell脚本重新挂载出问题的卷

Posted 007+1

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了shell脚本重新挂载出问题的卷相关的知识,希望对你有一定的参考价值。

#!/bin/bash
#卷的全路径示例
#pathexample =mount -t cetusfs 127.0.0.1:/cinderv/var/lib/cinder/volumes/0f6a20f4d81ed9db37f2a87260dd7181
volumesPath=`df -h |awk ‘{print$1$6}‘|grep volumes` #获取卷路径
pathRow=`df -h |awk ‘{print$1$6}‘|grep volumes|wc -l` #列出卷的数量
print pathRow
print volumesPath
#strerror=`ll $volumesPath|grep error` #获取改卷是否有error字符
#判断如果$error不为空则umount出错卷,然后重启服务,mount卷,如果返回为空则endif
for i in NF
do
strerror=`df -h|grep volumes|awk ‘NR == i{print$6}‘`
str=`ls "$strerror"`
if [ -n "$strerror"]
then
umount "$volumesPath"
service cinder-volume restart
mount -t cetusfs "$volumePath"
fi
done




















以上是关于shell脚本重新挂载出问题的卷的主要内容,如果未能解决你的问题,请参考以下文章

Shell ❀ Linux系统磁盘快速挂载执行脚本

Shell ❀ Linux系统磁盘快速挂载执行脚本

Shell ❀ Linux系统磁盘快速挂载执行脚本

在 Linux 中使用 shell 脚本自动创建 / 移除并挂载交换文件

Linux Shell 脚本:如何检测 NFS 挂载点(或服务器)已死?

在 Linux 中使用 shell 脚本自动创建/移除并挂载交换文件