首页 > 代码库 > dell服务器硬盘的状态变成外来(foreign)命令行修复
dell服务器硬盘的状态变成外来(foreign)命令行修复
Idrac监控报错:登陆ideac卡后如下如所示:硬盘状态是红叉,状态是外来
命令行安装MegaCli
rpm -ivh MegaCli-8.07.08-1.noarch.rpm
查看包的安装路径
rpm -ql MegaCli-8.07.08-1.noarch
/opt/MegaRAID/MegaCli/MegaCli
/opt/MegaRAID/MegaCli/MegaCli64
/opt/MegaRAID/MegaCli/libstorelibir-2.so.14.07-0
执行状态检测命令:
/opt/MegaRAID/MegaCli/MegaCli64 -pdlist -aall |grep ‘Firmware state‘
Firmware state: Unconfigured(good), Spun Up
Firmware state: Online, Spun Up
Firmware state: Online, Spun Up
Firmware state: Online, Spun Up
Firmware state: Online, Spun Up
Firmware state: Online, Spun Up
Firmware state: Online, Spun Up
Firmware state: Online, Spun Up
执行导入命令
/opt/MegaRAID/MegaCli/MegaCli64 -CfgForeign -Import -aall
Foreign configuration is imported on controller 0.
Exit Code: 0x00
再次执行状态检测命令:
/opt/MegaRAID/MegaCli/MegaCli64 -pdlist -aall |grep ‘Firmware state‘
Firmware state: Rebuild
Firmware state: Online, Spun Up
Firmware state: Online, Spun Up
Firmware state: Online, Spun Up
Firmware state: Online, Spun Up
Firmware state: Online, Spun Up
Firmware state: Online, Spun Up
Firmware state: Online, Spun Up
查询 Rebuild 进度:
/opt/MegaRAID/MegaCli/MegaCli64 -pdrbld -showprog -physdrv[32:0] -a0
显示如下:
Rebuild Progress on Device at Enclosure 32, Slot 0 Completed 38% in 54 Minutes.
Exit Code: 0x00
或者
/opt/MegaRAID/MegaCli/MegaCli64 -pdrbld -ProgDsply -physdrv[32:0] -a0
显示如下:
Rebuild progress of physical drives...
Enclosure:Slot Percent Complete Time Elps
032 :00 ####################***40 %*********************** 00:56:40
Press <ESC> key to quit...
备注:
Enclosure Device ID: 32
Slot Number: 0
以上两条信息通过/opt/MegaRAID/MegaCli/MegaCli64 -pdlist -aall |less 来查看
扫描外来配置的个数:
# /opt/MegaRAID/MegaCli/MegaCli64 -cfgforeign -scan -a0
清除外来配置:
# /opt/MegaRAID/MegaCli/MegaCli64 -cfgforeign -clear -a0
再次扫描外来配置的个数:
# /opt/MegaRAID/MegaCli/MegaCli64 -cfgforeign -scan -a0
1.显示Rebuid进度
/opt/MegaRAID/MegaCli/MegaCli64 -PDRbld -ShowProg -physdrv[20:2] -aALL
2.查看E S
/opt/MegaRAID/MegaCli/MegaCli64 -PDList -aAll -NoLog | grep -Ei "(enclosure|slot)"
3.查看所有硬盘的状态
/opt/MegaRAID/MegaCli/MegaCli64 -PDList -aAll -NoLog
4.查看所有Virtual Disk的状态
/opt/MegaRAID/MegaCli/MegaCli64 -LdPdInfo -aAll -NoLog
RAID Level对应关系:
RAID Level : Primary-1, Secondary-0, RAID Level Qualifier-0 | RAID 1 |
RAID Level : Primary-0, Secondary-0, RAID Level Qualifier-0 | RAID 0 |
RAID Level : Primary-5, Secondary-0, RAID Level Qualifier-3 | RAID 5 |
RAID Level : Primary-1, Secondary-3, RAID Level Qualifier-0 | RAID 10 |
5.在线做Raid
/opt/MegaRAID/MegaCli/MegaCli64 -CfgLdAdd -r0[0:11] WB NORA Direct CachedBadBBU -strpsz64 -a0 -NoLog
/opt/MegaRAID/MegaCli/MegaCli64 -CfgLdAdd -r5 [12:2,12:3,12:4,12:5,12:6,12:7] WB Direct -a0
6.点亮指定硬盘(定位)
/opt/MegaRAID/MegaCli/MegaCli64 -PdLocate -start -physdrv[252:2] -a0
7.清除Foreign状态
/opt/MegaRAID/MegaCli/MegaCli64 -CfgForeign -Clear -a0
8.查看RAID阵列中掉线的盘
/opt/MegaRAID/MegaCli/MegaCli64 -pdgetmissing -a0
9.替换坏掉的模块
/opt/MegaRAID/MegaCli/MegaCli64 -pdreplacemissing -physdrv[12:10] -Array5 -row0 -a0
10.手动开启rebuid
/opt/MegaRAID/MegaCli/MegaCli64 -pdrbld -start -physdrv[12:10] -a0
11.查看Megacli的log
/opt/MegaRAID/MegaCli/MegaCli64 -FwTermLog dsply -a0 > adp2.log
12.设置HotSpare
/opt/MegaRAID/MegaCli/MegaCli64-pdhsp -set[-Dedicated[-Array2]][-EnclAffinity][-nonRevertible]-PhysDrv[4:11]-a0
/opt/MegaRAID/MegaCli/MegaCli64-pdhsp -set[-EnclAffinity][-nonRevertible]-PhysDrv[32:1}]-a0
MegaCli -PDHSP -Set -Dedicated -Array0 -physdrv[E:S] -a0 添加局部热备盘,其中array0表示第0个raid
MegaCli -pdhsp -set -physdrv[E:S] -a0 添加全局热备盘
MegaCli -pdhsp -rmv -physdrv[E:S] -a0 移除全局和热备局部热备
13.关闭Rebuild
/opt/MegaRAID/MegaCli/MegaCli64 -AdpAutoRbld -Dsbl -a0
14.设置rebuild的速率
/opt/MegaRAID/MegaCli/MegaCli64 -AdpSetProp RebuildRate -30 -a0
附其他详细命令:
1. 常用命令:
#/opt/MegaRAID/MegaCli/MegaCli64 -LDInfo -Lall -aALL 查raid级别
#/opt/MegaRAID/MegaCli/MegaCli64 -AdpAllInfo -aALL 查raid卡信息
#/opt/MegaRAID/MegaCli/MegaCli64 -PDList -aALL 查看硬盘信息
#/opt/MegaRAID/MegaCli/MegaCli64 -AdpBbuCmd -aAll 查看电池信息
#/opt/MegaRAID/MegaCli/MegaCli64 -FwTermLog -Dsply -aALL 查看raid卡日志
#/opt/MegaRAID/MegaCli/MegaCli64 -adpCount 【显示适配器个数】
#/opt/MegaRAID/MegaCli/MegaCli64 -AdpGetTime –aALL 【显示适配器时间】
#/opt/MegaRAID/MegaCli/MegaCli64 -AdpAllInfo -aAll 【显示所有适配器信息】
#/opt/MegaRAID/MegaCli/MegaCli64 -LDInfo -LALL -aAll 【显示所有逻辑磁盘组信息】
#/opt/MegaRAID/MegaCli/MegaCli64 -PDList -aAll 【显示所有的物理信息】
#/opt/MegaRAID/MegaCli/MegaCli64 -AdpBbuCmd -GetBbuStatus -aALL |grep ‘Charger Status’ 【查看充电状态】
#/opt/MegaRAID/MegaCli/MegaCli64 -AdpBbuCmd -GetBbuStatus -aALL【显示BBU状态信息】
#/opt/MegaRAID/MegaCli/MegaCli64 -AdpBbuCmd -GetBbuCapacityInfo -aALL【显示BBU容量信息】
#/opt/MegaRAID/MegaCli/MegaCli64 -AdpBbuCmd -GetBbuDesignInfo -aALL 【显示BBU设计参数】
#/opt/MegaRAID/MegaCli/MegaCli64 -AdpBbuCmd -GetBbuProperties -aALL 【显示当前BBU属性】
#/opt/MegaRAID/MegaCli/MegaCli64 -cfgdsply -aALL 【显示Raid卡型号,Raid设置,Disk相关信息】
#/opt/MegaRAID/MegaCli/MegaCli64 -adpallinfo -aall|grep -i temp 查看温度
2. 磁带状态的变化,从拔盘,到插盘的过程中
Device |Normal|Damage|Rebuild|Normal
Virtual Drive |Optimal|Degraded|Degraded|Optimal
Physical Drive |Online|Failed –> Unconfigured|Rebuild|Online
3. 查看磁盘缓存策略
#/opt/MegaCli -LDGetProp -Cache -L0 -a0
or
#/opt/MegaCli -LDGetProp -Cache -L1 -a0
or
#/opt/MegaCli -LDGetProp -Cache -LALL -a0
or
#/opt/MegaCli -LDGetProp -Cache -LALL -aALL
or
#/opt/MegaCli -LDGetProp -DskCache -LALL -aALL
4.设置磁盘缓存策略
缓存策略解释:
WT (Write through
WB (Write back)
NORA (No read ahead)
RA (Read ahead)
ADRA (Adaptive read ahead)
Cached
Direct
例子:
#/opt/MegaCli -LDSetProp WT|WB|NORA|RA|ADRA -L0 -a0
or
#/opt/MegaCli -LDSetProp -Cached|-Direct -L0 -a0
or
enable / disable disk cache
#/opt/MegaCli -LDSetProp -EnDskCache|-DisDskCache -L0 -a0
/opt/MegaRAID/MegaCli/MegaCli64 -DiscardPreservedCache -Lall -a0 -NoLOG 【清空缓存】
5. 创建一个 raid5 阵列,由物理盘 2,3,4 构成,该阵列的热备盘是物理盘 5
#/opt/MegaCli -CfgLdAdd -r5 [1:2,1:3,1:4] WB Direct -Hsp[1:5] -a0
6. 创建阵列,不指定热备
#/opt/MegaCli -CfgLdAdd -r5 [1:2,1:3,1:4] WB Direct -a0
7. 删除阵列
#/opt/MegaCli -CfgLdDel -L1 -a0
8. 在线添加磁盘
#/opt/MegaCli -LDRecon -Start -r5 -Add -PhysDrv[1:4] -L1 -a0
9. 阵列创建完后,会有一个初始化同步块的过程,可以看看其进度。
#/opt/MegaCli -LDInit -ShowProg -LALL -aALL
或者以动态可视化文字界面显示
#/opt/MegaCli -LDInit -ProgDsply -LALL -aALL
10. 查看阵列后台初始化进度
#/opt/MegaCli -LDBI -ShowProg -LALL -aALL
或者以动态可视化文字界面显示
#/opt/MegaCli -LDBI -ProgDsply -LALL -aALL
11. 指定第 5 块盘作为全局热备
#/opt/MegaCli -PDHSP -Set [-EnclAffinity] [-nonRevertible] -PhysDrv[1:5] -a0
12. 指定为某个阵列的专用热备
#/opt/MegaCli -PDHSP -Set [-Dedicated [-Array1]] [-EnclAffinity] [-nonRevertible] -PhysDrv[1:5] -a0
13. 删除全局热备
#/opt/MegaCli -PDHSP -Rmv -PhysDrv[1:5] -a0
14. 将某块物理盘下线/上线
#/opt/MegaCli -PDOffline -PhysDrv [1:4] -a0
15. 查看物理磁盘重建进度
#/opt/MegaCli -PDRbld -ShowProg -PhysDrv [1:5] -a0
或者以动态可视化文字界面显示
#/opt/MegaCli -PDRbld -ProgDsply -PhysDrv [1:5] -a0
dell服务器硬盘的状态变成外来(foreign)命令行修复