您的位置:首页 > 大数据 > 人工智能

使用MegaCli工具查看Raid磁盘阵列状态

2016-09-27 13:42 309 查看
转载自:http://home.51.com/chenjianghui1987/diary/item/10051836.html
文章本身我不做过多修改了,在这里我就把自己在安装时候碰到的难点跟大家提下。
1.何处下载?
首先,根据文章中的路径已经下载不到相应的文件了,在此我们就自己到http://www.lsi.com的网站上去搜,尝试了各种组合
最后终于用linux_cli.zip在搜索栏中搜索出相应结果,找到linux版本,下载即可。
为了安全起见我还将文件上传至下载空间,以备不时之需。
http://down.51cto.com/data/342011
2.如何使用?
安装完后的文件依然存放在/opt目录下,但是内部多了几层目录。
/opt/MegaRAID/MegaCli/MegaCli64 后跟着相应的参数即可。
megacli功能还是非常强大的。在想获得更多raid信息及硬盘细节问题等细节上,得到了更多底层的数据
Linux操作系统下使用MegaCli工具查看Raid磁盘阵列状态
新版本的MegaCli-1.01.24-0.i386.rpm会把程序安装在/opt下,可以自定义安装目录,例如:rpm –relocate
/opt/=/usr/sbin/ -i MegaCli-1.01.24-0.i386.rpm 即把安装目录 /opt 替换成
/usr/sbin。下载地址:http://www.lsi.com/support/downloads/megaraid/miscellaneous/linux/Linux_MegaCLI_1.01.24.zip 我这里介绍安装在/opt下。
1. 首先介绍下Linux系统本身查看
软件raid:查看raid级别,状态等信息
#cat /proc/mdstat
硬件raid:查看raid的厂商,型号,级别
#dmesg | grep -i raid
#cat /proc/scsi/scsi
2.硬件raid最佳的办法是通过已安装的raid厂商的管理工具来查看,下面安装MegaCLI工具查看
首先下载MegaCli,解压缩。#rpm -ivh MegaCli-1.01.24-0.i386.rpm 安装在/opt下,所以执行命令都是/opt/MegaCli 哦。
命令使用:
#/opt/MegaCli -LDInfo -Lall -aALL 查raid级别
#/opt/MegaCli -AdpAllInfo -aALL 查raid卡信息
#/opt/MegaCli -PDList -aALL 查看硬盘信息
#/opt/MegaCli -AdpBbuCmd -aAll 查看电池信息
#/opt/MegaCli -FwTermLog -Dsply -aALL 查看raid卡日志
#/opt/MegaCli -adpCount 【显示适配器个数】
#/opt/MegaCli -AdpGetTime –aALL 【显示适配器时间】
#/opt/MegaCli -AdpAllInfo -aAll 【显示所有适配器信息】
#/opt/MegaCli -LDInfo -LALL -aAll 【显示所有逻辑磁盘组信息】
#/opt/MegaCli -PDList -aAll 【显示所有的物理信息】
#/opt/MegaCli -AdpBbuCmd -GetBbuStatus -aALL |grep ‘Charger Status’ 【查看充电状态】
#/opt/MegaCli -AdpBbuCmd -GetBbuStatus -aALL【显示BBU状态信息】
#/opt/MegaCli -AdpBbuCmd -GetBbuCapacityInfo -aALL【显示BBU容量信息】
#/opt/MegaCli -AdpBbuCmd -GetBbuDesignInfo -aALL 【显示BBU设计参数】
#/opt/MegaCli -AdpBbuCmd -GetBbuProperties -aALL 【显示当前BBU属性】
#/opt/MegaCli -cfgdsply -aALL 【显示Raid卡型号,Raid设置,Disk相关信息】
3.磁带状态的变化,从拔盘,到插盘的过程中。
Device |Normal|Damage|Rebuild|Normal
Virtual Drive |Optimal|Degraded|Degraded|Optimal
Physical Drive |Online|Failed –> Unconfigured|Rebuild|Online
4.查看磁盘缓存策略
#/opt/MegaCli -LDGetProp -Cache -L0 -a0
or
#/opt/MegaCli -LDGetProp -Cache -L1 -a0
or
#/opt/MegaCli -LDGetProp -Cache -LALL -a0
ro
#/opt/MegaCli -LDGetProp -Cache -LALL -aALL
ro
#/opt/MegaCli -LDGetProp -DskCache -LALL -aALL
5.设置磁盘缓存策略
缓存策略解释:
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
6.创建一个 raid5 阵列,由物理盘 2,3,4 构成,该阵列的热备盘是物理盘 5
#/opt/MegaCli -CfgLdAdd -r5 [1:2,1:3,1:4] WB Direct -Hsp[1:5] -a0
7.创建阵列,不指定热备
#/opt/MegaCli -CfgLdAdd -r5 [1:2,1:3,1:4] WB Direct -a0
8.删除阵列
#/opt/MegaCli -CfgLdDel -L1 -a0
9.在线添加磁盘
#/opt/MegaCli -LDRecon -Start -r5 -Add -PhysDrv[1:4] -L1 -a0
10.阵列创建完后,会有一个初始化同步块的过程,可以看看其进度。
#/opt/MegaCli -LDInit -ShowProg -LALL -aALL
或者以动态可视化文字界面显示
#/opt/MegaCli -LDInit -ProgDsply -LALL -aALL
11.查看阵列后台初始化进度
#/opt/MegaCli -LDBI -ShowProg -LALL -aALL
或者以动态可视化文字界面显示
#/opt/MegaCli -LDBI -ProgDsply -LALL -aALL
12.指定第 5 块盘作为全局热备
#/opt/MegaCli -PDHSP -Set [-EnclAffinity] [-nonRevertible] -PhysDrv[1:5] -a0
13.指定为某个阵列的专用热备
#/opt/MegaCli -PDHSP -Set [-Dedicated [-Array1]] [-EnclAffinity] [-nonRevertible] -PhysDrv[1:5] -a0
14.删除全局热备
#/opt/MegaCli -PDHSP -Rmv -PhysDrv[1:5] -a0
15.将某块物理盘下线/上线
#/opt/MegaCli -PDOffline -PhysDrv [1:4] -a0
#/opt/MegaCli -PDOnline -PhysDrv [1:4] -a0
16.查看物理磁盘重建进度
#/opt/MegaCli -PDRbld -ShowProg -PhysDrv [1:5] -a0
或者以动态可视化文字界面显示
#/opt/MegaCli -PDRbld -ProgDsply -PhysDrv [1:5] -a0

#-----------------------------------
/opt/MegaRAID/MegaCli/MegaCli64 -PDRbld -ShowProg -physdrv[32:2] -aALL

下面转自: http://blog.sina.com.cn/s/blog_57c70e190101ebl9.html 今天给服务器DELL
R710加硬盘,准备在线做raid,以前不太注意这些事,搞起来花了一些时间,不过还好是搞定了,赶紧记录下来,免的日后忘记了。

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

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

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

查看阵列卡信息
lspci -v
/opt/MegaRAID/MegaCli/MegaCli64 -AdpAllInfo -aALL

查看所有物理硬盘状态
/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 not
found.

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












这里我的硬盘被标记为“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[32:2] WB
Direct -a0

Adapter 0: Created VD 2

Adapter 0: Configured the Adapter!!

Exit Code: 0x00













删除阵列:
# /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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息