一、MegaCli命令介绍

一、MegaCli命令介绍

MegaCli是一款管理维护硬件RAID软件,可以用来查看raid信息等
MegaCli 的Media Error Count: 0 Other Error Count: 0 
Medai Error Count 表示磁盘可能错误,可能是磁盘有坏道,这个值不为0值得注意,数值越大,危险系数越高,
Other Error Count 表示磁盘可能存在松动,可能需要重新再插入。MegaCli 可以对阵列中所有的磁盘进行检测。

二、安装过程

1、系统环境

dmidecode -t1 | egrep "Manufacturer|Product Name"
cat /etc/redhat-release
查看厂商和产品型号,以及"Serial Number"

2、下载和安装

rpm -qa | egrep ‘Lib_Utils|MegaCli‘ //检查是否安装
https://raw.githubusercontent.com/crazy-zhangcong/tools/master/MegaCli8.07.10.tar.gz
ftp://download2.boulder.ibm.com/ecc/sar/CMA/XSA/ibm_utl_sraidmr_megacli-8.00.48_linux_32-64.zip
解压过后有linux目录

  1. [root@localhost MegaCli8.07.10]# tree
  2. ├── Linux
  3. ├── Lib_Utils-1.00-09.noarch.rpm
  4. ├── MegaCli-8.02.21-1.noarch.rpm
  5.  
  6. [root@localhost Linux]# rpm -ivh Lib_Utils-1.00-09.noarch.rpm MegaCli-8.02.21-1.noarch.rpm
  7. [root@localhost Linux]# ln -sv /opt/MegaRAID/MegaCli/MegaCli64 /usr/bin/
  8. "/usr/bin/MegaCli64" -> "/opt/MegaRAID/MegaCli/MegaCli64"

三、硬盘命令使用

1、常用查询命令

  1. /opt/MegaRAID/MegaCli/MegaCli64 -LDInfo -Lall -aALL 【查raid级别】
  2. /opt/MegaRAID/MegaCli/MegaCli64 -AdpAllInfo -aALL 【查raid卡信息】
  3. /opt/MegaRAID/MegaCli/MegaCli64 -PDList -aALL 查看【硬盘信息】
  4. /opt/MegaRAID/MegaCli/MegaCli64 -AdpBbuCmd -aAll 【查看电池信息】
  5. /opt/MegaRAID/MegaCli/MegaCli64 -FwTermLog -Dsply -aALL 【查看raid卡日志】
  6. /opt/MegaRAID/MegaCli/MegaCli64 -adpCount 【显示适配器个数】
  7. /opt/MegaRAID/MegaCli/MegaCli64 -AdpGetTime aALL 【显示适配器时间】
  8. /opt/MegaRAID/MegaCli/MegaCli64 -AdpAllInfo -aAll 【显示所有适配器信息】
  9. /opt/MegaRAID/MegaCli/MegaCli64 -LDInfo -LALL -aAll 【显示所有逻辑磁盘组信息】
  10. /opt/MegaRAID/MegaCli/MegaCli64 -PDList -aAll 【显示所有的物理信息】
  11. /opt/MegaRAID/MegaCli/MegaCli64 -AdpBbuCmd -GetBbuStatus -aALL |grep Charger Status 【查看充电状态】
  12. /opt/MegaRAID/MegaCli/MegaCli64 -AdpBbuCmd -GetBbuStatus -aALL【显示BBU状态信息】
  13. /opt/MegaRAID/MegaCli/MegaCli64 -AdpBbuCmd -GetBbuCapacityInfo -aALL【显示BBU容量信息】
  14. /opt/MegaRAID/MegaCli/MegaCli64 -AdpBbuCmd -GetBbuDesignInfo -aALL 【显示BBU设计参数】
  15. /opt/MegaRAID/MegaCli/MegaCli64 -AdpBbuCmd -GetBbuProperties -aALL 【显示当前BBU属性】
  16. /opt/MegaRAID/MegaCli/MegaCli64 -cfgdsply -aALL 【显示Raid卡型号,Raid设置,Disk相关信息】

2、查看磁盘缓存策略

  1. /opt/MegaRAID/MegaCli/MegaCli64 -LDGetProp -Cache -L0 -a0【显示0 RAID 0 RAID组的缓存策略
  2. /opt/MegaRAID/MegaCli/MegaCli64 -LDGetProp -Cache -L1 -a0【显示1 RAID 0 RAID组的缓存策略】
  3. /opt/MegaRAID/MegaCli/MegaCli64 -LDGetProp -Cache -LALL -a0【显示所有RAID 0 RAID组的缓存策略】
  4. /opt/MegaRAID/MegaCli/MegaCli64 -LDGetProp -Cache -LALL aALL【显示所有 RAID 所有 RAID组的缓存策略】
  5. /opt/MegaRAID/MegaCli/MegaCli64 -LDGetProp -DskCache -LALL -aALL

设置磁盘的缓存模式和访问方式 (Change Virtual Disk Cache and Access Parameters)

  1. Description Allows you to change the following virtual disk parameters:
  2. -WT (Write through), WB (Write back): Selects write policy.
  3. -NORA (No read ahead), RA (Read ahead), ADRA (Adaptive read ahead): Selects read policy.
  4. -Cached, -Direct: Selects cache policy.
  5. -RW, -RO, Blocked: Selects access policy.
  6. -EnDskCache: Enables disk cache.
  7. -DisDskCache: Disables disk cache.
  8. MegaCli -LDSetProp { WT | WB|NORA |RA | ADRA|-Cached|Direct} |
  9. {-RW|RO|Blocked} |
  10. {-Name[string]} |
  11. {-EnDskCache|DisDskCache} Lx |
  12. -L0,1,2|-Lall -aN|-a0,1,2|-aALL
  13. MegaCli -LDSetProp WT -L0 -a0

3、设置磁盘缓存策略

显示磁盘缓存和访问方式(Display Virtual Disk Cache and Access Parameters)

  1. MegaCli -LDGetProp -Cache | -Access | -Name | -DskCache -Lx|-L0,1,2|
  2. -Lall -aN|-a0,1,2|-aALL
  3. Displays the cache and access policies of the virtual disk(s):
  4. -WT (Write through), WB (Write back): Selects write policy.
  5. -NORA (No read ahead), RA (Read ahead), ADRA (Adaptive read ahead): Selects read policy.
  6. -Cache, -Cached, Direct: Displays cache policy.
  7. -Access, -RW, -RO, Blocked: Displays access policy.
  8. -DskCache: Displays physical disk cache policy.

缓存策略解释:

  1. WT (Write through)
  2. WB (Write back)
  3. NORA (No read ahead)
  4. RA (Read ahead)
  5. ADRA (Adaptive read ahead)
  6. C (Cached)
  7. D (Direct)

例子:
/opt/MegaRAID/MegaCli/MegaCli64 -LDSetProp WT|WB|NORA|RA|ADRA -L0 -a0
/opt/MegaRAID/MegaCli/MegaCli64 -LDSetProp -Cached|-Direct -L0 -a0
enable / disable disk cache
/opt/MegaRAID/MegaCli/MegaCli64 -LDSetProp -EnDskCache|-DisDskCache -L0 -a0

4、创建阵列

创建一个raid5阵列,由物理盘2,3,4构成,该阵列的热备盘是物理盘5
/opt/MegaRAID/MegaCli/MegaCli64 -CfgLdAdd -r5 [1:2,1:3,1:4] WB Direct -Hsp[1:5] -a0
创建阵列,不指定热备
/opt/MegaRAID/MegaCli/MegaCli64 -CfgLdAdd -r5 [1:2,1:3,1:4] WB Direct -a0
创建一个raid10阵列,由物理盘2,3和4,5分别做raid1,在将两组raid1做raid0
/opt/MegaRAID/MegaCli/MegaCli64 –CfgSpanAdd –r10 –Array0[1:2,1:3] –Array1[1:4,1:5] WB Direct -a0

5、删除阵列

/opt/MegaRAID/MegaCli/MegaCli64 -CfgLdDel -L1 -a0

6、在线添加磁盘

/opt/MegaRAID/MegaCli/MegaCli64 -LDRecon -Start -r5 -Add -PhysDrv[1:4] -L1 -a0

7、阵列创建完后,会有一个初始化同步块的过程,可以看看其进度。

/opt/MegaRAID/MegaCli/MegaCli64 -LDInit -ShowProg -LALL -aALL
或者以动态可视化文字界面显示
/opt/MegaRAID/MegaCli/MegaCli64 -LDInit -ProgDsply -LALL -aALL

扫描二维码关注公众号,回复: 9469664 查看本文章

8、查看阵列后台初始化进度

/opt/MegaRAID/MegaCli/MegaCli64 -LDBI -ShowProg -LALL -aALL
或者以动态可视化文字界面显示
/opt/MegaRAID/MegaCli/MegaCli64 -LDBI -ProgDsply -LALL -aALL

9、指定第5块盘作为全局热备

/opt/MegaRAID/MegaCli/MegaCli64 -PDHSP -Set [-EnclAffinity] [-nonRevertible] -PhysDrv[1:5] -a0

10、指定为某个阵列的专用热备

/opt/MegaRAID/MegaCli/MegaCli64 -PDHSP -Set [-Dedicated [-Array1]] [-EnclAffinity] [-nonRevertible] -PhysDrv[1:5] -a0

11、删除全局热备

/opt/MegaRAID/MegaCli/MegaCli64 -PDHSP -Rmv -PhysDrv[1:5] -a0

12、将某块物理盘下线/上线

/opt/MegaRAID/MegaCli/MegaCli64 -PDOffline -PhysDrv [1:4] -a0
/opt/MegaRAID/MegaCli/MegaCli64 -PDOnline -PhysDrv [1:4] -a0

13、查看物理磁盘重建进度

/opt/MegaRAID/MegaCli/MegaCli64 -PDRbld -ShowProg -PhysDrv [1:5] -a0
或者以动态可视化文字界面显示
/opt/MegaRAID/MegaCli/MegaCli64 -PDRbld -ProgDsply -PhysDrv [1:5] -a0

14、磁盘状态的变化,从拔盘,到插盘过程中

Device |Normal|Damage|Rebuild|Normal
Virtual Drive |Optimal|Degraded|Degraded|Optimal
Physical Drive |Online|Failed –> Unconfigured|Rebuild|Online

四、其他命令说明

1、当前raid缓存状态,raid缓存状态设置为wb的话要注意电池放电事宜,设置电池放电模式为自动学习模式

/opt/MegaRAID/MegaCli/MegaCli64 -ldgetprop -dskcache -lall -aall

2、电池设置相关

查看电池状态信息(Display BBU Status Information)
MegaCli -AdpBbuCmd -GetBbuStatus -aN|-a0,1,2|-aALL
MegaCli -AdpBbuCmd -GetBbuStatus -aALL

查看电池容量(Display BBU Capacity Information)
MegaCli -AdpBbuCmd -GetBbuCapacityInfo -aN|-a0,1,2|-aALL
MegaCli -AdpBbuCmd -GetBbuCapacityInfo –aALL

查看电池设计参数(Display BBU Design Parameters)
MegaCli -AdpBbuCmd -GetBbuDesignInfo -aN|-a0,1,2|-aALL
MegaCli -AdpBbuCmd -GetBbuDesignInfo –aALL

查看电池属性(Display Current BBU Properties)
MegaCli -AdpBbuCmd -GetBbuProperties -aN|-a0,1,2|-aALL
MegaCli -AdpBbuCmd -GetBbuProperties –aALL

设置电池为学习模式为循环模式(Start BBU Learning Cycle)
Description Starts the learning cycle on the BBU.
No parameter is needed for this option.
MegaCli -AdpBbuCmd -BbuLearn -aN|-a0,1,2|-aALL

3、通过脚本检测RAID 磁盘状态

  1. MEGACLI="/opt/MegaRAID/MegaCli/MegaCli64 "
  2. $MEGACLI -pdlist -aALL | grep "Firmware state" | awk -F : ‘{print $2}‘ | awk -F , ‘{print $1}‘
  3. $MEGACLI -pdlist -aALL | grep -E "Media Error|Other Error" | awk -F : ‘{print $2}‘

4、raid图解

图1、图2

centos 系统查看raid信息的更多相关文章

  1. linux查看RAID信息

    linux查看RAID信息 发表于2013 年 12 月 22 日 RAID分为软RAID和硬RAID 软RAID查看 cat /proc/mdstat 硬RAID查看 在启动画面进raid卡查看 I ...

  2. centos系统查看本机IP地址

    centos系统查看本机IP地址,输入 ifconfig -a查看 centos查询上网公网IP输入 curl ifconfig.me 命令即可查看 centos查询上网网关IP,tracepath  ...

  3. 使用MegaCli查看raid信息

    LSI SAS based MegaRAID driver http://www.lsi.com/downloads/Public/Nytro/downloads/Nytro%20XD/MegaCli ...

  4. CentOS系统查看软件安装路径

    Linux系统一般都是命令行界面,对于安装的软件也是通过命令安装的.对于软件包更新和卸载等有时候需要查看检查是否有改软件,软件安装存储的路径对于修改配置文件等是必要的.那么怎么查看软件安装路径呢?小编 ...

  5. Linux系统查看日志信息总结

    命令: cat tail -f #系统日志文件存放路径: /var/log/message #系统启动后的信息和错误日志 /var/log/secure #与安全相关的日志信息 /var/log/ma ...

  6. 查看Linux系统下Raid信息

    软件raid:只能通过Linux系统本身来查看 cat /proc/mdstat 可以看到raid级别,状态等信息. 硬件raid: 最佳的办法是通过已安装的raid厂商的管理工具来查看,有cmdli ...

  7. linux 系统下查看raid信息,以及磁盘信息

    有时想知道服务器上有几块磁盘,如果没有做raid,则可以简单使用fdisk -l  就可以看到. 但是做了raid呢,这样就看不出来了.那么如何查看服务器上做了raid? 软件raid:只能通过Lin ...

  8. Centos系统查看CPU有关信息

    top命令按1,看到几个CPU就代表是几核的. 查看CPU有几颗逻辑cpu,4代表有4个逻辑CPU,同时CPU的型号也打印出了,服务器一般都是至强的CPU [root@svn ~]# cat /pro ...

  9. centos系统查看系统版本、内核版本、系统位数、cpu个数、核心数、线程数

    centos查看系统版本 cat /etc/redhat-release CentOS Linux release 7.2.1511 (Core) 1)查看centos内核的版本: [root@loc ...

随机推荐

    1. percona5.7 源码安装

      200 ? "200px" : this.width)!important;} --> 介绍 主要为了测试percona的线程池的性能,这里就简单介绍一下percona5.7 ...

    2. spring cloud 学习研究- spring-cloud-microservice-example

      spring cloud + docker 微服务架构 http://www.open-open.com/lib/view/open1437363835818.html 实例项目 https://gi ...

    3. ACM ICPC 2015 Moscow Subregional Russia, Moscow, Dolgoprudny, October, 18, 2015 G. Garden Gathering

      Problem G. Garden Gathering Input file: standard input Output file: standard output Time limit: 3 se ...

    4. HDU 1465

      排列 Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Description 大家常常 ...

    5. [HDOJ2639]Bone Collector II(第k优01背包)

      题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2639 题意:求01背包的第k优解 dp(i, j)表示容量为j时的i优解 对于第二维的操作和01背包几 ...

    6. git常见问题

      一.设置git的user name和email: git config --global user.name "lei.li" git config --global user.e ...

    7. web HTML5 调用摄像头的代码

      最近公司要求做一个在线拍照的功能,具体代码如下: <html> <head> <title>html5调用摄像头拍照</title> <style ...

    8. SKScene类

      继承自 SKEffectNode:SKNode:UIResponder:NSObject 符合 NSCoding(SKNode)NSCopying(SKNode)NSObject(NSObject) ...

    9. CCFlow最近在山东济南总部举行组团培训活动,有參加的能够报名

      最近.CCFlow将会组织培训,由总设计师--周朋先生亲自授课. 行程                        培训内容 第一天                     ccflow的概述功能简 ...

    10. hibernate 解决诡异的mysql存入中文乱码

      使用hibernate查询mysql,通过bean的get方法拿到字符串再写入mysql中的字段会中文乱码,需要String string = xxx.get(),把g

 

猜你喜欢

转载自www.cnblogs.com/xuanbjut/p/12380022.html
今日推荐