战翔海 發表於 2025-6-13 00:00:00

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

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