背景:

lsi MegaRAID raid卡管理工具能查如下信息:

raid的level,

raid是几块物理硬盘构成的,

物理硬盘的制造商.


首先,介绍下Linux系统中查看raid厂商.


软件raid:查看raid级别,状态等信息


#cat /proc/mdstat



硬件raid:查看raid的厂商,型号,级别


#dmesg | grep -i raid


#cat /proc/scsi/scsi



比如如下的输出:

[root@rac1 disk]# dmesg | grep -i raid
[ 2.657117] megaraid_sas 0000:01:00.0: irq 95 for MSI/MSI-X
[ 2.657128] megaraid_sas 0000:01:00.0: irq 96 for MSI/MSI-X
[ 2.657138] megaraid_sas 0000:01:00.0: irq 97 for MSI/MSI-X
[ 2.657153] megaraid_sas 0000:01:00.0: irq 98 for MSI/MSI-X
[ 2.657163] megaraid_sas 0000:01:00.0: irq 99 for MSI/MSI-X
[ 2.657173] megaraid_sas 0000:01:00.0: irq 100 for MSI/MSI-X
[ 2.657183] megaraid_sas 0000:01:00.0: irq 101 for MSI/MSI-X
[ 2.657192] megaraid_sas 0000:01:00.0: irq 102 for MSI/MSI-X
[ 2.657202] megaraid_sas 0000:01:00.0: irq 103 for MSI/MSI-X
[ 2.657212] megaraid_sas 0000:01:00.0: irq 104 for MSI/MSI-X
[ 2.657221] megaraid_sas 0000:01:00.0: irq 105 for MSI/MSI-X
[ 2.657236] megaraid_sas 0000:01:00.0: irq 106 for MSI/MSI-X
[ 2.657267] megaraid_sas 0000:01:00.0: [scsi0]: FW supports<96> MSIX vector,Online CPUs: <12>,Current MSIX <12>
[ 2.700640] megaraid_sas 0000:01:00.0: Firmware supports 256 VD 256 PD
[ 2.700656] megaraid_sas 0000:01:00.0: Driver supports 256 VD 256 PD
[ 2.767437] megaraid_sas 0000:01:00.0: Controller type: MR,Memory size is: 2048MB
[ 2.767439] megaraid_sas 0000:01:00.0: Firmware Crash dump feature is supported
[ 2.788549] scsi host0: LSI SAS based MegaRAID driver
[root@rac1 disk]#


这就确定是LSI的raid卡控制器.



下载并安装lsi MegaRAID raid卡 管理工具




在如上的网址中,在搜索框里搜索"megacli",点击确定,找到Management Software and Tools (188) 下的 MegaCLI 5.5 P2  (这是命令行工具),


注意不要下载Latest MegaRAID Storage Manager (MSM) ,这个MSM是图形化的管理工具.



另:lsi已经被avago收购了.



如下是安装过程:



[root@rac1 ~]# cd tool/
[root@rac1 tool]# ll
total 7756
-rw-r--r-- 1 root root 7939395 Sep 8 15:39 8-07-14_MegaCLI.zip
[root@rac1 tool]# 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@rac1 tool]# ls -lrt
total 7824
-rw-r--r-- 1 root root 48298 Jan 19 2014 8.07.14_MegaCLI.txt
-rw-r--r-- 1 root root 7939395 Sep 8 15:39 8-07-14_MegaCLI.zip
drwxr-xr-x 2 root root 4096 Sep 8 15:39 DOS
drwxr-xr-x 2 root root 4096 Sep 8 15:39 FreeBSD
drwxr-xr-x 2 root root 4096 Sep 8 15:39 Linux
drwxr-xr-x 2 root root 4096 Sep 8 15:39 Solaris
drwxr-xr-x 2 root root 4096 Sep 8 15:39 Windows
[root@rac1 tool]# cd Linux/
[root@rac1 Linux]# ls -lrt
total 1516
-rw-r--r-- 1 root root 1549650 Dec 16 2013 MegaCli-8.07.14-1.noarch.rpm
[root@rac1 Linux]# rpm -ivh MegaCli-8.07.14-1.noarch.rpm
Preparing... ################################# [100%]
Updating / installing...
1:MegaCli-8.07.14-1 ################################# [100%]
[root@rac1 Linux]# cd /opt/
[root@rac1 opt]# ls
MegaRAID ORCLfmap localyum lsi
[root@rac1 opt]# cd MegaRAID/
[root@rac1 MegaRAID]# ls
MegaCli
[root@rac1 MegaRAID]# cd MegaCli/
[root@rac1 MegaCli]# ls -lrt
total 3188
-rwx------ 1 root root 540512 Dec 16 2013 libstorelibir-2.so.14.07-0
-rwxr-xr-x 1 root root 2720320 Dec 16 2013 MegaCli64
-rw-r--r-- 1 root root 0 Sep 8 15:39 install.log
lrwxrwxrwx 1 root root 48 Sep 8 15:39 libstorelibir-2.so -> /opt/MegaRAID/MegaCli/libstorelibir-2.so.14.07-0
[root@rac1 MegaCli]# ./MegaCli64 -PDList -aALL

Adapter #0


Enclosure Device ID: 252
Slot Number: 0
Drive's position: DiskGroup: 0, Span: 0, Arm: 0
Enclosure position: N/A
Device Id: 0
WWN: 500003971843FAC5
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--------------------------------------------------------->>>硬盘接口是sas.


Raw Size: 279.396 GB [0x22ecb25c Sectors]
Non Coerced Size: 278.896 GB [0x22dcb25c Sectors]
Coerced Size: 278.875 GB [0x22dc0000 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: 1004
Shield Counter: 0
Successful diagnostics completion on : N/A
SAS Address(0): 0x500003971843fac6
SAS Address(1): 0x0
Connected Port Number: 0(path0)
Inquiry Data: TOSHIBA AL13SEB300 100466P0A0MHFWC9 -------------------------->>>硬盘制造商是东芝
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 :31C (87.80 F)
PI Eligibility: No
Drive is formatted for PI information: No
PI: No PI
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: 1
WWN: 500003971843C221
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: 279.396 GB [0x22ecb25c Sectors]
Non Coerced Size: 278.896 GB [0x22dcb25c Sectors]
Coerced Size: 278.875 GB [0x22dc0000 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: 1004
Shield Counter: 0
Successful diagnostics completion on : N/A
SAS Address(0): 0x500003971843c222
SAS Address(1): 0x0
Connected Port Number: 1(path0)
Inquiry Data: TOSHIBA AL13SEB300 100466P0A05SFWC9
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: No
Drive is formatted for PI information: No
PI: No PI
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


-----以下限于篇幅,不再截取-------------


如下是查看raid级别:

[root@rac1 MegaCli]# ./MegaCli64 -LDInfo -Lall -aALL


Adapter 0 -- Virtual Drive Information:
Virtual Drive: 0 (Target Id: 0)
Name :
RAID Level : Primary-5, Secondary-0, RAID Level Qualifier-3 --------------------------->>>>这是raid 5.
Size : 836.625 GB
Sector Size : 512
Is VD emulated : No
Parity Size : 278.875 GB
State : Optimal
Strip Size : 256 KB
Number Of Drives : 4
Span Depth : 1
Default Cache Policy: WriteBack, ReadAdaptive, Cached, No Write Cache if Bad BBU
Current Cache Policy: WriteThrough, ReadAdaptive, Cached, No Write Cache if Bad BBU
Default Access Policy: Read/Write
Current Access Policy: Read/Write
Disk Cache Policy : Enabled
Encryption Type : None
PI type: No PI

Is VD Cached: No



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