标签:rpm otto ack ado 就是 mis 浪潮 数据 check
前言:在工作场景中,不乏遇到在线阵列配置或硬盘模式更改的。为了方便理解,打一个不是很恰当的比方:一台业务机器除系统盘外全部单盘raid0做数据挂载,在业务运行过程中,有一块硬盘坏了,我们在线更换硬盘后,因为硬盘模式的问题,此时系统是无法识别硬盘的,对不对,那怎么办?重启机器配置阵列?那如果业务较重要,不能停机呢?这时就是perccli和storccli大展身手的时候了。
其实perccli和storccli就是同一个工具,语法完全一样,只是命令名字不一样,适用的品牌不一样。perccli适用于dell机器,storccli适用于华为、浪潮(其它品牌没有测试过,不确认)。下面指令以perccli做示例。顺便贴个下载链接吧。
https://downloads.dell.com/FOLDER03559396M/1/perccli-1.17.10-1.noarch.rpm
https://downloadmirror.intel.com/26820/eng/StorCli.zip
一、常用指令
# ./perccli64 /c0/eall/sall show 查看物理硬盘信息列表 # ./perccli64 /c0/vall 查看虚拟磁盘信息列表,即阵列信息 # ./perccli64 /c0 show preservedCache 查看虚拟磁盘丢失信息 # ./perccli64 /c0/fall show all 查看脱机硬盘信息 # ./perccli64 /c0/v11 delete preservedcache 清除控制器0上的虚拟磁盘11的缓存信息 # ./perccli64 /c0/fall delete 清除外来硬盘配置信息 # ./perccli64 /c0/fall import [preview ] 导入外来硬盘配置 # ./perccli64 /c0 add vd r0 drives=32:10 wb ra 编号为32:10的硬盘做raid0 # ./perccli64 /c0 add vd r5 size=all drives=32:01,32:02,32:03 对应编号3块硬盘做raid5 # ./perccli64 /c0 add vd r1 size=all drives=32:01,32:02 对应编号2块硬盘做raid1
二、运用示例
1.讲其它示例前,我们先把前言部分硬盘更换重做raid0的问题先解决
# 先清除故障硬盘缓存信息 get_miss_vds=`./perccli64 /c0 show preservedcache | awk '/Missing/ {print $1}'` ./perccli64 /c0/fall delete &> /dev/null if [ -z "$get_miss_vds" ]; then echo "No miss virtual disk,pass..." exit else for i in $get_miss_vds; do ./perccli64 /c0/v$i delete preservedcache done fi # 判断物理硬盘模式信息,如果处于UGood模式则创建raid0 ugood_disks=`./perccli64 /c0/eall/sall show | awk '/^[0-9].*UGood/ {print $1}'` for i in $ugood_disks; do ./perccli64 /c0 add vd r0 drives=$i wb ra done
如上,无论你是坏几块盘,只要系统还没有崩溃,都可运行。如果是多阵列运行,需注意硬盘所属阵列,如果raid1的系统盘有一块同时处于故障系列,需等待系统盘阵列同步完成后才可执行上述代码
2.硬盘模式更改
diskType=`echo $1 | egrep -io 'SSD|HDD|ALL'` destMode=`echo $1 | egrep -io 'jbod|online'` jbod_status=`./perccli64 /c0 show jbod | awk '/^JBOD/{print $1}'` if [ "$1" == "ALL_online" -a "$jbod_status" == "ON" ]; then # 关闭jbod模式,所有硬盘自动转换为UGood模式后,磁盘可用于阵列创建 ./perccli64 /c0 set jbod=off &> /dev/null elif [ "$1" != "ALL_online" -a "$jbod_status" == "OFF" ]; then # 启用jbod,适用于hadoop等业务机器数据挂载 ./perccli64 /c0 set jbod=on &> /dev/null fi # 根据$1定义需转换的源硬盘类型 if [ "$diskType" == "ALL" -a "$destMode" == "jbod" ]; then reMode='^[0-9].*UGood' elif [ "$diskType" == "HDD" -a "$destMode" == "online" ]; then # 所有HDD的JBOD硬盘转换为UGood模式 reMode='^[0-9].*JBOD.*HDD' elif [ "$diskType" == "HDD" -a "$destMode" == "jbod" ]; then #所有HDD磁盘转换为JBOD模式 reMode='^[0-9].*UGood.*HDD' elif [ "$diskType" == "SSD" -a "$destMode" == "jbod" ]; then # 所有SSD转为JBOD模式 reMode='^[0-9].*UGood.*SSD' elif [ "$diskType" == "SSD" -a "$destMode" == "online" ]; then # 所有SSD转换为UGood模式 reMode='^[0-9].*JBOD.*SSD' else echo -e "\e[0;31;1m当前脚本不支持此类型硬盘模式转换\e[0m" exit 2 fi # 开始转换 ./perccli64 /c0/eall/sall show | egrep $reMode | awk -F '[ :]' '{print $1,$1}' | while read EID SLOT; do if [ "${destMode}" == "jbod" ]; then ./perccli64 /c0/e$EID/s$SLOT set ${destMode} &> /dev/null elif [ "${destMode}" == "online" ]; then ./perccli64 /c0/e$EID/s$SLOT set good force &> /dev/null fi # 检查转换结果 diskState=`./perccli64 /c0/eall/sall show | egrep -w "${EID}:${SLOT}" | awk '{print $3}' | sed 's/UGood/online/g' | tr 'A-Z' 'a-z'` if [ "$diskState" == "$destMode" ]; then echo "$EID:$SLOT state set $destMode success" else echo -e "\e[0;31;1m$EID:$SLOT set $destMode failed,please check\e[0m" exit fi done
其实这两个命令更适合的场景是根据业务类型在ks文件中定义阵列,通过pxe下发,物理机系统安装前即可自动配置阵列了。
标签:rpm otto ack ado 就是 mis 浪潮 数据 check
原文地址:http://blog.51cto.com/wuyanc/2063110