设备名称:

[root@DB232 shell]# cat /proc/scsi/scsi
Attached devices:
Host: scsi0 Channel: 02 Id: 00 Lun: 00
  Vendor: DELL     Model: PERC 5/i         Rev: 1.03
  Type:   Direct-Access                    ANSI SCSI revision: 05
[root@DB232 shell]#

运行出错:

[root@DB232 opt]# smartctl -i /dev/sda
smartctl 5.42 2011-10-20 r3458 [x86_64-linux-2.6.18-238.el5] (local build)
Copyright (C) 2002-11 by Bruce Allen, http://smartmontools.sourceforge.net

Smartctl open device: /dev/sda failed: DELL or MegaRaid controller, please try adding ‘-d megaraid,N’
[root@DB232 opt]#

MegaCli是一款管理维护硬件RAID软件,可以通过它来了解当前raid卡的所有信息,包括
raid卡的型号,raid的阵列类型,raid
上各磁盘状态,等等。通常,我们对硬盘当前的状态不太好确定,一般通过机房人员巡检来完成,有没有通过软件的方式来检查确定这个问题呢。MegaCli就
可以做到,一般通过 MegaCli 的

下载:http://ftp.cs.stanford.edu/pub/rpms/centos/5/x86_64/

http://ftp.cs.stanford.edu/pub/rpms/centos/5/x86_64/MegaCli-8.00.46-1.i386.rpm

[root@DB232 opt]# wget http://ftp.cs.stanford.edu/pub/rpms/centos/5/x86_64/MegaCli-8.00.46-1.i386.rpm

安装出错:

[root@DB232 opt]# rpm -ivh MegaCli-8.00.46-1.i386.rpm
error: Failed dependencies:
    Lib_Utils is needed by MegaCli-8.00.46-1.i386

解决:

[root@DB232 opt]# wget http://ftp.cs.stanford.edu/pub/rpms/centos/5/x86_64/Lib_Utils-1.00-08.noarch.rpm

[root@DB232 opt]# rpm -ivh Lib_Utils-1.00-08.noarch.rpm
Preparing…                ########################################### [100%]
Installing….
   1:Lib_Utils              ########################################### [100%]
[root@DB232 opt]# rpm -ivh MegaCli-8.00.46-1.i386.rpm
Preparing…                ########################################### [100%]
   1:MegaCli                ########################################### [100%]
[root@DB232 opt]#

安装位置:

[root@DB232 MegaCli]# ls -al /opt/MegaRAID/MegaCli/MegaCli64
-rwxr-xr-x 1 root root 2247688 2011-02-03 /opt/MegaRAID/MegaCli/MegaCli64
[root@DB232 MegaCli]#

查看RAID级别:

[root@DB232 MegaCli]# /opt/MegaRAID/MegaCli/MegaCli64 -LDInfo -Lall -aALL

Adapter 0 — Virtual Drive Information:
Virtual Drive: 0 (Target Id: 0)
Name                :database
RAID Level          : Primary-1, Secondary-3, RAID Level Qualifier-0
Size                : 203.25 GB
State               : Optimal
Strip Size          : 64 KB
Number Of Drives per span:2
Span Depth          : 3
Default Cache Policy: WriteBack, ReadAheadNone, Direct, No Write Cache if Bad BBU
Current Cache Policy: WriteThrough, ReadAheadNone, Direct, No Write Cache if Bad BBU
Access Policy       : Read/Write
Disk Cache Policy   : Disk’s Default
Encryption Type     : None

Exit Code: 0x00
[root@DB232 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相关信息】

[root@DB232 MegaCli]# /opt/MegaRAID/MegaCli/MegaCli64 -cfgdsply -aALL
                                    
=============================================================
Adapter: 0
Product Name: PERC 5/i Integrated
Memory: 256MB
BBU: Present
Serial No: 12345
==============================================================

[root@DB232 MegaCli]# ls -al /dev/megaraid_sas_ioctl_node
cr——– 1 root root 253, 0 04-15 13:23 /dev/megaraid_sas_ioctl_node
[root@DB232 MegaCli]#

下面使用smartctl透过Raid卡获取磁盘更详细的信息:

# smartctl manual 摘录..
              Under Linux , to look at SCSI/SAS disks behind LSI MegaRAID controllers, use syntax such as:
              smartctl -a -d megaraid,2 /dev/sda
              smartctl -a -d megaraid,0 /dev/sdb
             
where in the argument megaraid,N, the integer N is the physical disk
number within the MegaRAID controller.  This  interface  will
             
also work for Dell PERC controllers.  The following /dev/XXX entry must
exist:                 # 经测试只要存在即可,对应关系搞错确也仍可正常显示
              For PERC2/3/4 controllers: /dev/megadev0
              For PERC5/6 controllers: /dev/megaraid_sas_ioctl_node

[root@DB232 MegaCli]# smartctl -a -d megaraid,0 /dev/sda1

-------------------------------------------------------------------------------------------------------------------------------------------------------------

c233 ~ # smartctl -a -d megaraid,0 /dev/sda                     //在天津233执行的结果
smartctl 5.42 2011-10-20 r3458 [x86_64-linux-2.6.36-gentoo-r8] (local build)
Copyright (C) 2002-11 by Bruce Allen, http://smartmontools.sourceforge.net

Vendor:               SEAGATE
Product:              ST3146755SS     
Revision:             T106
User Capacity:        146,815,733,760 bytes [146 GB]
Logical block size:   512 bytes
Logical Unit id:      0x5000c50001fa3487
Serial number:        3LN0DAQZ
Device type:          disk
Transport protocol:   SAS
Local Time is:        Tue Jul  7 14:08:10 2015 CST
Device supports SMART and is Enabled
Temperature Warning Disabled or Not Supported
SMART Health Status: OK

Current Drive Temperature:     39 C
Drive Trip Temperature:        68 C
Elements in grown defect list: 0
Vendor (Seagate) cache information
  Blocks sent to initiator = 2033818666
  Blocks received from initiator = 1189632289
  Blocks read from cache and sent to initiator = 224505734
  Number of read and write commands whose size <= segment size = 254557295
  Number of read and write commands whose size > segment size = 12531253
Vendor (Seagate/Hitachi) factory information
  number of hours powered up = 66374.83
  number of minutes until next internal SMART test = 17

Error counter log:
           Errors Corrected by           Total   Correction     Gigabytes    Total
               ECC          rereads/    errors   algorithm      processed    uncorrected
           fast | delayed   rewrites  corrected  invocations   [10^9 bytes]  errors
read:   160704420        4         0  160704424   160704424       1139.656           0
write:         0        0         0         0          0       5032.699           0
verify: 449944729        0         0  449944729   449944729      25972.300           0

Non-medium error count:       39

SMART Self-test log
Num  Test              Status                 segment  LifeTime  LBA_first_err [SK ASC ASQ]
     Description                              number   (hours)
# 1  Background long   Aborted (by user command)   -     168                 - [-   -    -]
# 2  Background long   Aborted (by user command)   -     159                 - [-   -    -]
# 3  Background long   Completed                   -       1                 - [-   -    -]
# 4  Background short  Completed                   -       0                 - [-   -    -]

Long (extended) Self Test duration: 1941 seconds [32.4 minutes]

使用MegaCli和Smartctl获取普通磁盘的更多相关文章

  1. 获取windows磁盘的可用空间函数

    <?php /* *获取某个磁盘的剩余空间 *$param 关联数组,下标是哪个盘,单位,可以是B,KB,MB,GB *可以设置获取多个磁盘,例如:array('C'=>'KB','D'= ...

  2. C++ 通过WIN32 API 获取逻辑磁盘详细信息

    众所周知,在微软的操作系统下编写应用程序,最主要的还是通过windows所提供的api函数来实现各种操作的,这些函数通常是可以直接使用的,只要包含windows.h这个头文件, 下载源文件 今天我们主 ...

  3. iphone获取当前磁盘信息

    获取iphone磁盘总大小.已使用空间.空闲空间 [代码]悦德财富:https://www.yuedecaifu.com 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 ...

  4. C++通过WIN32 API获取逻辑磁盘详细信息

      众所周知,在微软的操作系统下编写应用程序,最主要的还是通过windows所提供的api函数来实现各种操作的,这些函数通常是可以直接使用的,只要包含windows.h这个头文件. 今天我们主要介绍的 ...

  5. C#获取本地磁盘信息【转载】

      直接上干货简单易懂 //磁盘监控(远程/本地)//需要引用System.Management.dllpublic class RemoteMonitoring{private static str ...

  6. C#获取本地磁盘信息

    直接上干货简单易懂 //磁盘监控(远程/本地) //需要引用System.Management.dll public class RemoteMonitoring { private static s ...

  7. python3 获取电脑磁盘、CPU、内存使用情况

    import psutil # cd C:\Python36-32\Scripts pip install psutil # 获取本机磁盘使用率和剩余空间G信息 def get_disk_info() ...

  8. qt 获取系统磁盘空间大小

    quint64 getDiskFreeSpace(QString driver) { LPCWSTR lpcwstrDriver=(LPCWSTR)driver.utf16(); ULARGE_INT ...

  9. linux下 stat statfs 获取 文件 磁盘 信息

    stat函数讲解 表头文件:    #include <sys/stat.h>              #include <unistd.h> 定义函数:    int st ...

随机推荐

  1. 每天一个linux命令(22):chgrp命令

    在 lunix系统里,文件或目录的权限的掌控以拥有者及所诉群组来管理.可以使用chgrp指令取变更文件与目录所属群组,这种方式采用群组名称或群组识别 码都可以.Chgrp命令就是change grou ...

  2. [Windows 64] (搬运)价值¥ 6,499的软件Navicat Premium11.2.11 最新版及其注册机

    Navicat Premium可以连接6种数据库并开发> 转载于:http://www.52pojie.cn/thread-529020-1-1.html

  3. Qt模型/视图框架----简单的例子

    #include<qapplication.h> #include<qfilesystemmodel.h> #include<qtreeview.h> #inclu ...

  4. OC基础--block

    block与函数类似:1.可以保存代码 2.又返回值 3.有形参 4.调用方式一样 block的标志:^ 一.定义一个无参无返回值的block void (^myBlock)();--1.void 代 ...

  5. js 选项卡实现

    <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8&quo ...

  6. 【BZOJ 3223】文艺平衡树 模板题

    就是打个翻转标记,下推标记时记得交换左右孩子指针,查询kth和中序遍历输出时也记得要下推标记同时交换指针,二者不可缺!←这是易错点 仿陈竞潇学长模板的代码: #include<cctype> ...

  7. codevs 1835 魔法猪学院 A*寻k短路做了一个月卡死在spfa那了/(ㄒoㄒ)/~~

    SPFA时点出队后一定要把在队内的标记置为false!SPFA时点出队后一定要把在队内的标记置为false!SPFA时点出队后一定要把在队内的标记置为false! 我因为这个卡了一个月大家信吗?测得时 ...

  8. PHP配置,php.ini以及覆盖问题

    在部署一个cms项目到服务器上的时候,因为cms的模板比较老,服务器上用的php是5.3.3版(大于5.3,可以认为是新的),有些页面会显示"deprecated"类别的错误信息. ...

  9. groovy-运算符

    算术和条件运算符 Groovy支”!”操作符,例如: 1 def expression = false 2 assert !expression 基于集合的运算符: Spread Operator ( ...

  10. UVA 1398 Meteor

    传送门 Solution: 记一颗流星在视野内的时间段为(L, R), 为了使所有(L, R)都取整数,首先将坐标放大. 放大倍数可取为 LCM(1, 2, ..., 10)= 2520 接着计算:从 ...