今天给服务器DELLR710加硬盘,准备在线做raid,以前不太注意这些事,搞起来花了一些时间,不过还好是搞定了,赶紧记录下来,免的日后忘记了。


用MegaCli做阵列,最重要是就是这三个系数:
Adapter #0
Enclosure Device ID: 32
Slot Number: 0

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

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

查看所有物理硬盘状态
/opt/MegaRAID/MegaCli/MegaCli64 -PDList -a0

# /opt/MegaRAID/MegaCli/MegaCli64 help |grep -i pdinfo
MegaCli -pdInfo -PhysDrv[E0:S0,E1:S1,...] -aN|-a0,1,2|-aALL
MegaCli -LdPdInfo -aN|-a0,1,2|-aALL

查看逻辑盘详细信息
# /opt/MegaRAID/MegaCli/MegaCli64 -LdPdInfo-aALL

查看单个盘的详细信息
# /opt/MegaRAID/MegaCli/MegaCli64 -pdInfo -PhysDrv[32:3] -aALL
Adapter 0: Device at Enclosure - 32, Slot - 3 is notfound.


像我新增加的硬盘就是 [32:2]
MegaCli操作1---创建与删除raid0_第1张图片

MegaCli操作1---创建与删除raid0_第2张图片

MegaCli操作1---创建与删除raid0_第3张图片

这里我的硬盘被标记为“Foreign”外来配置,要清除一下,不然会报下面这个错误:
The specified physical disk does not have the appropriateattributes 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[32:2] WBDirect -a0
Adapter 0: Created VD 2

Adapter 0: Configured the Adapter!!

Exit Code: 0x00

MegaCli操作1---创建与删除raid0_第4张图片

MegaCli操作1---创建与删除raid0_第5张图片

MegaCli操作1---创建与删除raid0_第6张图片


删除阵列:

# /opt/MegaRAID/MegaCli/MegaCli6  -cfgclr -a0   清除所有的raid组的配置

# /opt/MegaRAID/MegaCli/MegaCli6  -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

参考资料:
http://blog.csdn.net/heart_2011/article/details/7254404
http://zh.community.dell.com/techcenter/b/weblog/archive/2013/03/07/megacli-command-share.aspx