megacli03 - meetbill/op_practice_book GitHub Wiki

在线创建与删除raid0

创建前准备

用MegaCli做阵列,最重要是就是这三个系数:

Adapter #0
Enclosure Device ID: 32
Slot Number: 0

分别代表了 -PhysDrv[E0:S0,E1:S1,...] -aN #物理磁盘的 enclosure号:slot号 -a是阵列卡号

这些参数可以通过下面的命令得到。

查看阵列卡信息

$/opt/MegaRAID/MegaCli/MegaCli64 -AdpAllInfo -aALL

查看所有物理硬盘状态

$/opt/MegaRAID/MegaCli/MegaCli64 -PDList -a0  

查看逻辑盘详细信息

$/opt/MegaRAID/MegaCli/MegaCli64 -LdPdInfo -aALL 

查看单个盘的详细信息

# /opt/MegaRAID/MegaCli/MegaCli64 -pdInfo -PhysDrv[32:3] -aALL                                    
Adapter 0: Device at Enclosure - 32, Slot - 3 is not found.

像我新增加的硬盘就是 [32:2]

MegaCli操作1---创建raid0

这里我的硬盘被标记为“Foreign”外来配置,要清除一下,不然会报下面这个错误: The specified physical disk does not have the appropriate attributes to complete the requested command.

Exit Code: 0x26

对外来配置进行处理

扫描外来配置的个数:

# /opt/MegaRAID/MegaCli/MegaCli64 -cfgforeign -scan -a0                                            
There are 1 foreign configuration(s) on controller 0.
Exit Code: 0x00

清除外来配置:

# /opt/MegaRAID/MegaCli/MegaCli64 -cfgforeign -clear -a0                                  
Foreign configuration 0 is cleared on controller 0.
Exit Code: 0x00

再次扫描外来配置的个数:

# /opt/MegaRAID/MegaCli/MegaCli64 -cfgforeign -scan -a0                                   
There is no foreign configuration on controller 0.
Exit Code: 0x00

创建Raid0

#/opt/MegaRAID/MegaCli/MegaCli64 -CfgLdAdd -r0[8:15] WB RA Direct CachedBadBBU -strpsz256 -a0 -Nolog

Adapter 0: Created VD 2

Adapter 0: Configured the Adapter!!

Exit Code: 0x00

MegaCli操作2---删除raid0

删除阵列:

# /opt/MegaRAID/MegaCli/MegaCli64  -cfglddel  -L0 -a0

删除指定的raid组(Target Id: 0)的raid组,可以通过上面的“查看逻辑盘详细信息”得到。

查看硬盘的重建情况:

# /opt/MegaRAID/MegaCli/MegaCli64 -PDRbld -ProgDsply -PhysDrv [12:7] -aALL
Device(Encl-12 Slot-7) is not in rebuild process