一、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. [root@localhost Linux]# rpm -ivh Lib_Utils-1.00-09.noarch.rpm MegaCli-8.02.21-1.noarch.rpm
  6. [root@localhost Linux]# ln -sv /opt/MegaRAID/MegaCli/MegaCli64 /usr/bin/
  7. "/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

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

 

一、MegaCli命令介绍的更多相关文章

  1. MegaCli命令使用详解

    一.MegaCli命令介绍 MegaCli是一款管理维护硬件RAID软件,可以用来查看raid信息等MegaCli 的Media Error Count: 0 Other Error Count: 0 ...

  2. 12个Linux进程管理命令介绍(转)

    12个Linux进程管理命令介绍 [日期:2015-06-02] 来源:Linux中国  作者:Linux [字体:大 中 小]   执行中的程序在称作进程.当程序以可执行文件存放在存储中,并且运行的 ...

  3. 2.SDK目录结构和adb工具及命令介绍

    安卓开发学习笔记 1.安卓开发之环境搭建 2.SDK目录结构和adb工具及命令介绍 1.SDK目录介绍: ******************************** add-ons:Androi ...

  4. git各种命令介绍以及碰到的各种坑

    一.各种命令介绍: git pull:从其他的版本库(既可以是远程的也可以是本地的)将代码更新到本地,例如:'git pull origin master'就是将origin这个版本库的代码更新到本地 ...

  5. tar.xz如何解压:linux和windows下tar.xz解压命令介绍

    在linux下怎么解压和压缩tar.xz文件? (本文由www.169it.com搜集整理) 在linux下解压tar.xz文件步骤 1 2 # xz -d ***.tar.xz  //先解压xz # ...

  6. 查看MySQL数据库表的命令介绍

    如果需要查看MySQL数据库中都有哪些MySQL数据库表,应该如何实现呢?下面就为您介绍查看MySQL数据库表的命令,供您参考. 进入MySQL Command line client下查看当前使用的 ...

  7. Docker学习总结之Run命令介绍

    Docker学习总结之Run命令介绍 本文由Vikings(http://www.cnblogs.com/vikings-blog/) 原创,转载请标明.谢谢! 在使用Docker时,执行最多的命令某 ...

  8. maven常用命令介绍

    mvn 3.0.4 创建maven项目命令  mvn  archetype:generate   -DgroupId=damocles-autocredit -DartifactId=damocles ...

  9. [转帖]十二 个经典 Linux 进程管理命令介绍

    https://www.cnblogs.com/swordxia/p/4550825.html 接了 http referer 头 没法显示图片 可以去原始blog 里面去查看.   随笔- 109  ...

随机推荐

  1. 史上最全jdk新特性总结,涵盖jdk8到jdk15!

    前言 在本文中,我将描述自第8版以来Java最重要且对开发人员友好的功能.为什么会有这样的主意?在Web上,您可以找到许多文章,其中包含每种Java版本的新功能列表.但是,由于缺少文章,因此无法简要概 ...

  2. AutoAssign源码分析

    目录 AutoAssign源码分析 一. 简介 二. 论文理论 2.1 联合表示 2.2 正样本权重 2.3 负样本权重 2.4 总的loss 2.5 补充loss 三. 论文代码 四. 总结 五. ...

  3. BLE链路层状态机初探

    状态机 BLE链路层把所有的功能放到五种不同的状态中,在不同的状态分别执行不同的功能. 一般来说,BLE设备大致有这么几种状态:空闲,广播,扫描,发起连接和连接成功. 广播和扫描是相对应的,一个设备广 ...

  4. Java8中的Optional操作

    作者:汤圆 个人博客:javalover.cc 前言 官人们好啊,我是汤圆,今天给大家带来的是<Java8中的Optional操作>,希望有所帮助,谢谢 文章纯属原创,个人总结难免有差错, ...

  5. 当 Go struct 遇上 Mutex

    struct 是我们写 Go 必然会用到的关键字, 不过当 struct 遇上一些比较特殊类型的时候, 你注意过你的程序是否正常吗 ? 一段代码 type URL struct { Ip string ...

  6. Day17_104_IO_BufferReader接收用户输入

    BufferReader接收用户输入 **标准输入\输出流 java.lang.System** - static InputStream in - static PrintStream out im ...

  7. 扩展 GRTN:云原生趋势下的 RTC 架构演进

    在 2021 LiveVideoStackCon 音视频技术大会上海站,聚焦 "轻端重云和边缘架构新模式" 专场,阿里云视频云的 RTC 传输专家杨成立(忘篱)带来 "基 ...

  8. IDEA的Debug技巧

    01_Debug简介和意义 什么是程序DeBug? Debug,是程序开发人员必会的一项调试程序的技能. 企业中程序开发和程序调试的比例为1:1.5,可以说如果你不会调试程序,你就没有办法从事编程工作 ...

  9. 1113 Integer Set Partition

    Given a set of N (>) positive integers, you are supposed to partition them into two disjoint sets ...

  10. 1-OSI七层模型

    网络功能:数据传输 ISO(国际标准化组织) OSI七层模型---->网络通信工作流程的标准化 OSI七层模型 应用层:提供用户服务,具体功能由特定的程序而定. 表示层:数据的压缩优化,加密. ...