设备名称:

    [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级别:

    1. [root@KuaiCDN MegaCli]#
    2. [root@KuaiCDN MegaCli]# /opt/MegaRAID/MegaCli/MegaCli64 -LDInfo -Lall -aALL
    3. Adapter 0 -- Virtual Drive Information:
    4. Virtual Drive: 0 (Target Id: 0)
    5. Name :
    6. RAID Level : Primary-0, Secondary-0, RAID Level Qualifier-0
    7. Size : 465.25 GB
    8. State : Optimal
    9. Strip Size : 64 KB
    10. Number Of Drives : 1
    11. Span Depth : 1
    12. Default Cache Policy: WriteBack, ReadAhead, Direct, No Write Cache if Bad BBU
    13. Current Cache Policy: WriteBack, ReadAhead, Direct, No Write Cache if Bad BBU
    14. Access Policy : Read/Write
    15. Disk Cache Policy : Disk's Default
    16. Encryption Type : None
    17. Default Power Savings Policy: Controller Defined
    18. Current Power Savings Policy: None
    19. Can spin up in 1 minute: No
    20. LD has drives that support T10 power conditions: No
    21. LD's IO profile supports MAX power savings with cached writes: No
    22. Bad Blocks Exist: No
    23. Virtual Drive: 1 (Target Id: 1)
    24. Name :
    25. RAID Level : Primary-1, Secondary-0, RAID Level Qualifier-0
    26. Size : 1.818 TB
    27. State : Optimal
    28. Strip Size : 64 KB
    29. Number Of Drives : 4
    30. Span Depth : 1
    31. Default Cache Policy: WriteBack, ReadAhead, Direct, No Write Cache if Bad BBU
    32. Current Cache Policy: WriteBack, ReadAhead, Direct, No Write Cache if Bad BBU
    33. Access Policy : Read/Write
    34. Disk Cache Policy : Disk's Default
    35. Encryption Type : None
    36. Default Power Savings Policy: Controller Defined
    37. Current Power Savings Policy: None
    38. Can spin up in 1 minute: No
    39. LD has drives that support T10 power conditions: No
    40. LD's IO profile supports MAX power savings with cached writes: No
    41. Bad Blocks Exist: No
    42. Virtual Drive: 2 (Target Id: 2)
    43. Name :
    44. RAID Level : Primary-1, Secondary-0, RAID Level Qualifier-0
    45. Size : 1.818 TB
    46. State : Optimal
    47. Strip Size : 64 KB
    48. Number Of Drives : 4
    49. Span Depth : 1
    50. Default Cache Policy: WriteBack, ReadAhead, Direct, No Write Cache if Bad BBU
    51. Current Cache Policy: WriteBack, ReadAhead, Direct, No Write Cache if Bad BBU
    52. Access Policy : Read/Write
    53. Disk Cache Policy : Disk's Default
    54. Ongoing Progresses:
    55. Background Initialization: Completed 54%, Taken 52 min.
    56. Encryption Type : None
    57. Default Power Savings Policy: Controller Defined
    58. Current Power Savings Policy: None
    59. Can spin up in 1 minute: No
    60. LD has drives that support T10 power conditions: No
    61. LD's IO profile supports MAX power savings with cached writes: No
    62. Bad Blocks Exist: No
    63. Virtual Drive: 3 (Target Id: 3)
    64. Name :
    65. RAID Level : Primary-1, Secondary-0, RAID Level Qualifier-0
    66. Size : 1.818 TB
    67. State : Optimal
    68. Strip Size : 64 KB
    69. Number Of Drives : 4
    70. Span Depth : 1
    71. Default Cache Policy: WriteBack, ReadAhead, Direct, No Write Cache if Bad BBU
    72. Current Cache Policy: WriteBack, ReadAhead, Direct, No Write Cache if Bad BBU
    73. Access Policy : Read/Write
    74. Disk Cache Policy : Disk's Default
    75. Ongoing Progresses:
    76. Background Initialization: Completed 52%, Taken 52 min.
    77. Encryption Type : None
    78. Default Power Savings Policy: Controller Defined
    79. Current Power Savings Policy: None
    80. Can spin up in 1 minute: No
    81. LD has drives that support T10 power conditions: No
    82. LD's IO profile supports MAX power savings with cached writes: No
    83. Bad Blocks Exist: No
    84. Exit Code: 0x00
    85. [root@KuaiCDN MegaCli]#

    实用方法:
    命令使用:
    # /opt/MegaRAID/MegaCli/MegaCli64 -LDInfo -Lall -aALL 查raid级别
    # /opt/MegaRAID/MegaCli/MegaCli64 -AdpAllInfo -aALL 查raid卡信息
    # /opt/MegaRAID/MegaCli/MegaCli64 -PDList -aALL 查看硬盘信息
    # /opt/MegaRAID/MegaCli/MegaCli64 -AdpBbuCmd -aAll 查看电池信息
    # /opt/MegaRAID/MegaCli/MegaCli64 -FwTermLog -Dsply -aALL 查看raid卡日志
    # /opt/MegaRAID/MegaCli/MegaCli64 -adpCount 【显示适配器个数】
    # /opt/MegaRAID/MegaCli/MegaCli64 -AdpGetTime –aALL 【显示适配器时间】
    # /opt/MegaRAID/MegaCli/MegaCli64 -AdpAllInfo -aAll 【显示所有适配器信息】
    # /opt/MegaRAID/MegaCli/MegaCli64 -LDInfo -LALL -aAll 【显示所有逻辑磁盘组信息】
    # /opt/MegaRAID/MegaCli/MegaCli64 -PDList -aAll 【显示所有的物理信息】
    # /opt/MegaRAID/MegaCli/MegaCli64 -AdpBbuCmd -GetBbuStatus -aALL |grep ‘Charger Status’ 【查看充电状态】
    # /opt/MegaRAID/MegaCli/MegaCli64 -AdpBbuCmd -GetBbuStatus -aALL【显示BBU状态信息】
    # /opt/MegaRAID/MegaCli/MegaCli64 -AdpBbuCmd -GetBbuCapacityInfo -aALL【显示BBU容量信息】
    # /opt/MegaRAID/MegaCli/MegaCli64 -AdpBbuCmd -GetBbuDesignInfo -aALL 【显示BBU设计参数】
    # /opt/MegaRAID/MegaCli/MegaCli64 -AdpBbuCmd -GetBbuProperties -aALL 【显示当前BBU属性】
    # /opt/MegaRAID/MegaCli/MegaCli64 -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]
    文摘 https://www.cnblogs.com/itcomputer/p/4626850.html