Raid卡常用命令

在Linux系统下进行raid操作:
主要用于一台Linux服务器硬盘扩容,后插入几块新的硬盘来做raid1或raid5

1. 常用命令

#查看硬盘信息
/opt/MegaRAID/MegaCli/MegaCli64 -PDList -aALL
#查坏盘
/opt/MegaRAID/MegaCli/MegaCli64 -PDList -aALL | grep "Firmware state"
#查raid级别
/opt/MegaRAID/MegaCli/MegaCli64 -LDInfo -Lall -aALL
#查看一个raid由哪些盘组成
/opt/MegaRAID/MegaCli/MegaCli64 -LdPdInfo -aALL|more

#闪亮3槽位灯:
/opt/MegaRAID/MegaCli/MegaCli64 -PDLocate -start -physdrv[32:3] -a0
#关闪3槽位灯:
/opt/MegaRAID/MegaCli/MegaCli64 -PDLocate -stop -physdrv[32:3] -a0

#查看系统里有哪些raid组
/opt/MegaRAID/MegaCli/MegaCli64 -LDInfo -Lall -aALL

#删除raid组1,小心操作
/opt/MegaRAID/MegaCli/MegaCli64 -CfgLdDel -L1 -A0
注:L1的1为RIAD组 Target Id 号,L0通常装的系统不能删

#检查新硬盘是否存在foreign key
/opt/MegaRAID/MegaCli/MegaCli64 -CfgForeign -Scan -aALL
#清除foreign key
/opt/MegaRAID/MegaCli/MegaCli64 -CfgForeign -Clear -aALL

查看和清除 raid的 cache ,重建raid时可能需要
/opt/MegaRAID/MegaCli/MegaCli64 -GetPreservedCacheList -aALL
/opt/MegaRAID/MegaCli/MegaCli64 -DiscardPreservedCache -L7 -aall

#创建raid5
/opt/MegaRAID/MegaCli/MegaCli64 CfgLDAdd -r5 [32:4,32:5,32:6,32:7] -strpsz256 -A0

注:-strpsz 条带大小,raid卡默认即可,DellR730默认是64。华为RH288v3默认是256
32是 Enclosure Device ID:

外来盘导入完整的raid信息
/opt/MegaRAID/MegaCli/MegaCli64 -CfgForeign -Import -aall

  

参考:
https://segmentfault.com/a/1190000008780600
https://zhuanlan.zhihu.com/p/358739776?utm_id=0
http://www.cnweed.com/archives/4303/



posted @ 2023-04-30 14:23  莫让年华付水流  阅读(283)  评论(0编辑  收藏  举报