使用MegaCLI管理PC服务器本地磁盘阵列

写这篇文章的原因是在部署Oracle Exadata x4-2的过程中有部分和MegaCli64命令相关的内容,之后在安装部署IBM X3850 X5的时候,发现它和Exadata中SUN服务器使用的是相同的阵列卡,HP,DELL的PC服务器等大都也使用LSI的阵列卡,该类型的阵列卡通过MegaCli工具可以在操作系统层面对磁盘阵列进行非常方便的管理。

    从IBM X3850 X5来说,当RAID磁盘组中的某个磁盘的磁盘被替换掉,通常需要重启服务器进入WEBBIOS才能够看到新磁盘Rebuild的进度,有了MegaCli工具能够在不停止业务的情况下,在线的观察新磁盘是否Rebuild完成;通过MegaCli还可以检查RAID组的状态,检查磁盘的状态,给RAID组增加、删除磁盘等等,这篇文章非常肤浅的介绍了MegaCli工具,网上有非常详尽的介绍可以深入研究。

1.环境介绍。

[root@hisdb02 MegaCli]# dmidecode -s system-product-name
System x3850 X5 -[71437Y5]-

服务器是IBM x3850 X5。

[root@hisdb02 MegaCli]# lspci | grep RAID
09:00.0 RAID bus controller: LSI Logic / Symbios Logic MegaRAID SAS 2208 [Thunderbolt] (rev 03)

[root@hisdb02 MegaCli]# dmesg | grep "RAID"
scsi0 : LSI SAS based MegaRAID driver
scsi 0:0:0:0: Direct-Access     IBM      ServeRAID M5016  3.27 PQ: 0 ANSI: 5
scsi 0:2:0:0: Direct-Access     IBM      ServeRAID M5016  3.27 PQ: 0 ANSI: 5
md: Autodetecting RAID arrays.

2.安装MegaCli工具。

    MegaCli工具在系统光盘中没有自带,可以从服务器厂家的网站上下载,也可以直接到LSI的网站上下载最新的MegaCli工具。下面是LSI网站下载MegaCli工具的地址:http://www.lsi.com/support/pages/download-results.aspx?keyword=MegaCli,当前最新版本是:8.07.14。

执行下面的步骤安装MegaCli工具:

[root@hisdb02 Server]# cd /opt
[root@hisdb02 opt]# ls
8.07.14_MegaCLI.zip
[root@hisdb02 opt]# unzip 8.07.14_MegaCLI.zip 
Archive:  8.07.14_MegaCLI.zip
  inflating: 8.07.14_MegaCLI.txt     
  inflating: DOS/MegaCLI.exe         
 extracting: FreeBSD/MegaCLI.zip     
 extracting: FreeBSD/MegaCli64.zip   
  inflating: Linux/MegaCli-8.07.14-1.noarch.rpm  
  inflating: Solaris/MegaCli.pkg     
  inflating: Windows/MegaCli.exe     
  inflating: Windows/MegaCli64.exe   
[root@hisdb02 opt]# ls
8.07.14_MegaCLI.txt  8.07.14_MegaCLI.zip  DOS  FreeBSD  Linux  Solaris  Windows
[root@hisdb02 opt]# cd Linux/
[root@hisdb02 Linux]# ls
MegaCli-8.07.14-1.noarch.rpm
[root@hisdb02 Linux]# rpm -ivh MegaCli-8.07.14-1.noarch.rpm 
Preparing...                ########################################### [100%]
   1:MegaCli                ########################################### [100%]
[root@hisdb02 opt]# ls
8.07.14_MegaCLI.txt  8.07.14_MegaCLI.zip  DOS  FreeBSD  Linux  MegaRAID  Solaris  Windows
[root@hisdb02 opt]# cd MegaRAID/MegaCli
[root@hisdb02 MegaCli]# ls
install.log  libstorelibir-2.so  libstorelibir-2.so.14.07-0  MegaCli64

MegaCli64就是我们要用到的MegaCli命令,64表示是64位的工具。

3.常用命令。

1).查看RAID级别:
[root@hisdb02 MegaCli]# ./MegaCli64 -LdInfo -lAll -a0
                                     
Adapter 0 -- Virtual Drive Information:
Virtual Drive: 0 (Target Id: 0)
Name                :
RAID Level          : Primary-1, Secondary-0, RAID Level Qualifier-0    <<<< RAID级别是RAID10。
Size                : 557.861 GB
Sector Size         : 512
Is VD emulated      : No
Mirror Data         : 557.861 GB
State               : Optimal    <<<< 这是正常的状态。
Strip Size          : 128 KB
Number Of Drives    : 2    <<<< RAID组包含2块磁盘。
Span Depth          : 1    <<<< 深度是1,说明实际只是RAID 1。
Default Cache Policy: WriteBack, ReadAhead, Direct, No Write Cache if Bad BBU
Current Cache Policy: WriteBack, ReadAhead, Direct, No Write Cache if Bad BBU
Default Access Policy: Read/Write
Current Access Policy: Read/Write
Disk Cache Policy   : Disabled
Encryption Type     : None
PI type: No PI

Is VD Cached: No

这条命令查看的也是逻辑(虚拟)磁盘的状态,执行./MegaCli64 -LDInfo -LAll -aAll命令可以查看所有适配器的虚拟磁盘信息。

2).查看RAID控制器个数:
[root@hisdb02 MegaCli]#  ./MegaCli64 -adpCount
                                     
Controller Count: 1.

只有1个控制器。执行./MegaCli64 -AdpAllInfo -aAll命令可以查看所有适配器的详细信息。

3).查看物理磁盘信息:
[root@hisdb02 MegaCli]# ./MegaCli64 -Pdlist -a0
                                     
Adapter #0

第一块盘信息:

Enclosure Device ID: 252
Slot Number: 0
Drive's position: DiskGroup: 0, Span: 0, Arm: 0
Enclosure position: N/A
Device Id: 10
WWN: 5000C5007266557C
Sequence Number: 2
Media Error Count: 0
Other Error Count: 0
Predictive Failure Count: 0
Last Predictive Failure Event Seq Number: 0
PD Type: SAS

Raw Size: 558.911 GB [0x45dd2fb0 Sectors]
Non Coerced Size: 558.411 GB [0x45cd2fb0 Sectors]
Coerced Size: 557.861 GB [0x45bb9000 Sectors]
Sector Size:  512
Logical Sector Size:  512
Physical Sector Size:  512
Firmware state: Online, Spun Up    <<<< 磁盘当前的状态,这是正常的状态。
Commissioned Spare : No
Emergency Spare : No
Device Firmware Level: B56M
Shield Counter: 0
Successful diagnostics completion on :  N/A
SAS Address(0): 0x5000c5007266557d
SAS Address(1): 0x0
Connected Port Number: 1(path0) 
Inquiry Data: IBM-ESXSST600MM0006     B56MS0M2FFKB0221B5C5    
IBM FRU/CRU: 49Y2004     
FDE Capable: Not Capable
FDE Enable: Disable
Secured: Unsecured
Locked: Unlocked
Needs EKM Attention: No
Foreign State: None 
Device Speed: 6.0Gb/s 
Link Speed: 6.0Gb/s 
Media Type: Hard Disk Device
Drive:  Not Certified
Drive Temperature :32C (89.60 F)
PI Eligibility:  Yes 
Number of bytes of user data in LBA: 512 
Drive is formatted for PI information:  Yes 
PI: PI with type 2
Port-0 :
Port status: Active
Port's Linkspeed: 6.0Gb/s 
Port-1 :
Port status: Active
Port's Linkspeed: 6.0Gb/s 
Drive has flagged a S.M.A.R.T alert : No


第二块盘信息:

Enclosure Device ID: 252
Slot Number: 1
Drive's position: DiskGroup: 0, Span: 0, Arm: 1
Enclosure position: N/A
Device Id: 9
WWN: 5000C50072665134
Sequence Number: 2
Media Error Count: 0
Other Error Count: 0
Predictive Failure Count: 0
Last Predictive Failure Event Seq Number: 0
PD Type: SAS

Raw Size: 558.911 GB [0x45dd2fb0 Sectors]
Non Coerced Size: 558.411 GB [0x45cd2fb0 Sectors]
Coerced Size: 557.861 GB [0x45bb9000 Sectors]
Sector Size:  512
Logical Sector Size:  512
Physical Sector Size:  512
Firmware state: Online, Spun Up
Commissioned Spare : No
Emergency Spare : No
Device Firmware Level: B56M
Shield Counter: 0
Successful diagnostics completion on :  N/A
SAS Address(0): 0x5000c50072665135
SAS Address(1): 0x0
Connected Port Number: 0(path0) 
Inquiry Data: IBM-ESXSST600MM0006     B56MS0M2F9130221B5C5    
IBM FRU/CRU: 49Y2004     
FDE Capable: Not Capable
FDE Enable: Disable
Secured: Unsecured
Locked: Unlocked
Needs EKM Attention: No
Foreign State: None 
Device Speed: 6.0Gb/s 
Link Speed: 6.0Gb/s 
Media Type: Hard Disk Device
Drive:  Not Certified
Drive Temperature :32C (89.60 F)
PI Eligibility:  Yes 
Number of bytes of user data in LBA: 512 
Drive is formatted for PI information:  Yes 
PI: PI with type 2
Port-0 :
Port status: Active
Port's Linkspeed: 6.0Gb/s 
Port-1 :
Port status: Active
Port's Linkspeed: 6.0Gb/s 
Drive has flagged a S.M.A.R.T alert : No

    ./MegaCli64 -PDList -aALL命令显示的是所有适配器的信息,因为当前服务器只有一个适配器,所以该命令的输出结果和./MegaCli64 -Pdlist -a0命令一致。

4).检查物理磁盘状态:

[root@hisdb02 MegaCli]# ./MegaCli64 -Pdlist -a0|grep "Slot\|Firmware state"
Slot Number: 0
Firmware state: Online, Spun Up
Slot Number: 1
Firmware state: Online, Spun Up

5).查看当前RAID缓存状态:
[root@hisdb02 MegaCli]# ./MegaCli64 -ldgetprop -dskcache -lall -aall
                                     
Adapter 0-VD 0(target id: 0): Disk Write Cache : Disabled

6).各种磁盘设备的不同状态:
Device :         Normal|Damage|Rebuild|Normal
Virtual Drive :  Optimal|Degraded|Degraded|Optimal
Physical Drive : Online|Failed –> Unconfigured|Rebuild|Online

注意观察不同类型设备的状态,以判断设备是否出现故障;另外,当设备出现故障,在操作系统日志应该是有记录的。更多MegaCli64命令的用法等待你去发现。

包含如下操作系统版本 FreeBSD Linux Solaris Windows 分别对应如下目录 MegaCLI for DOS MegaCLI for Linux MegaCLI for Solaris MegaCLI for FreeBSD MegaCLI for Windows ********************************************* LSI Corp. MegaRAID MegaCLI Release ********************************************* Release Date: 01/20/14 ======================== Supported Controllers ================== MegaRAID SAS 9270-8i MegaRAID SAS 9271-4i MegaRAID SAS 9271-8i MegaRAID SAS 9271-8iCC MegaRAID SAS 9286-8e MegaRAID SAS 9286CV-8e MegaRAID SAS 9286CV-8eCC MegaRAID SAS 9265-8i MegaRAID SAS 9285-8e MegaRAID SAS 9240-4i MegaRAID SAS 9240-8i MegaRAID SAS 9260-4i MegaRAID SAS 9260CV-4i MegaRAID SAS 9260-8i MegaRAID SAS 9260CV-8i MegaRAID SAS 9260DE-8i MegaRAID SAS 9261-8i MegaRAID SAS 9280-4i4e MegaRAID SAS 9280-8e MegaRAID SAS 9280DE-8e MegaRAID SAS 9280-24i4e MegaRAID SAS 9280-16i4e MegaRAID SAS 9260-16i MegaRAID SAS 9266-4i MegaRAID SAS 9266-8i MegaRAID SAS 9285CV-8e MegaRAID SAS 8704ELP MegaRAID SAS 8704EM2 MegaRAID SAS 8708ELP MegaRAID SAS 8708EM2 MegaRAID SAS 8880EM2 MegaRAID SAS 8888ELP MegaRAID SAS 8308ELP* MegaRAID SAS 8344ELP* MegaRAID SAS 84016E* MegaRAID SAS 8408E* MegaRAID SAS 8480E* MegaRAID SATA 300-8ELP* *These older controllers should work but have not been tested. Component: ========= SAS MegaRAID MegaCLI Release Date: 01/20/14 Version Numbers: MegaCLI =============== =========== Current Version 8.07.14 Previous Version 8.07.07 Contents: ========= This package contains MegaCLI for the following OSes: DOS FreeBSD Linux Solaris Windows Use the MegaCLI components from the folder that matches your OS. Enhancements and Bug Fixes ========================== SCGCQ00393585 (DFCT) - VD creation from MegaCli fails on Solaris Sparc 10u9 operating system. SCGCQ00413883 (DFCT) - "megacli -version -pd -a0" Segmentation Faults if PDs are missing SCGCQ00445356 (CSET) - Megacli crashes after invoking any command in SGI system with one 9280-8e and 2 quad port qlogic FC cards. SCGCQ
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值