MegaRAID是LSI的一款命令行RAID管理工具,我们以往配置RAID时,都是通过WEB页面去配置,步骤繁琐,而且配置完毕还需要重启操作系统。MegaRAID工具可以让我们在命令行去配置管理RAID,效率高,使用起来非常awesome。对于习惯GUI方式的童鞋,这种方法简直就是一种梦靥。:-)。命令行的方式,可以不用重启操作系统,配置完毕就可以使用,非常便捷。

要想使用该工具,首先系统上要安装相应的软件包。安装完毕之后,在/opt目录

下回多出一个MegaRAID/MegaCli的目录,

 

本次使用该命令行工具的场景:

在第4、第5个插槽,新添加了两块Intel P3700 SSD盘,

 

1. 查看RAID卡的设备号

1
2
3
4
5
6
7
8
# cd /opt/MegaRAID/MegaCli
# ./MegaCli64 -PDList -aAll |grep "Device ID"
Enclosure Device ID: 252
Enclosure Device ID: 252
Enclosure Device ID: 252
Enclosure Device ID: 252
Enclosure Device ID: 252
Enclosure Device ID: 252

 

说明:上面的输出,表示我们有一个RAID卡,这个卡下面有6个盘。这里的ID号需

      要记下来,后面做RAID时需要用到。

 

2. 查看Slot ID,有没有错序的情况

1
2
3
4
5
6
7
8
# ./MegaCli64 -PDList -aAll |grep "Slot"
  
Slot Number: 0
Slot Number: 1
Slot Number: 2
Slot Number: 3
Slot Number: 4
Slot Number: 5

说明:这里的Slot Number号需要记下来,后面做RAID时需要用到。

 

 

3. 查看Foreign信息

1
2
3
4
5
6
7
# ./MegaCli64 -PDList -aAll |grep "Foreign State"
Foreign State: None
Foreign State: None
Foreign State: None
Foreign State: None
Foreign State: Foreign  # 这是新增加的
Foreign State: Foreign  # 这是新增加的

 

4. 清除Foreign信息

1
# ./MegaCli64 -CfgForeign -Clear -a0

 

5. 重新做RAID,在Slot4和Slot5上做RAID0

1
# ./MegaCli64 -CfgLdAdd -r0 [252:4,252:5] WT Direct -a0

说明:这条命令的意思是在Device ID为252的设备,其第4及第5个槽位的磁盘,做RAID0操作,并且磁盘缓存策略为WT(Write Through)方式。如果做RAID1,只需要把r0改为r1即可。

 

附录:名词解释

磁盘缓存策略:

1
2
3
4
5
WT(Write Through)
WB(Write Back)
NORA(NO Read Ahead)
RA(Read Ahead)
ADRA(Adaptive Read Ahead)

 

查看有多少个RAID级别,如果后续需要删除指定的RAID时需要用到,其中

“Target Id:n”,n即为第n组RAID

1
# ./MegaCli64 -LdInfo -Lall -aALL

 

删除阵列

1
# ./MegaCli64 -CfgLdDel -L1 -a0