首页 > 代码库 > 查看服务器型号、SN、Raid等信息

查看服务器型号、SN、Raid等信息

一、查看服务器型号

安装dmidecode

yum install dmidecode

 

1、查看服务器型号、SN信息

# dmidecode -t 1
# dmidecode 2.11
SMBIOS 2.7 present.

Handle 0x0024, DMI type 1, 27 bytes
System Information
        Manufacturer: IBM
        Product Name: IBM System x3650 M4: -[79159NZ]-
        Version: 0C
        Serial Number: 06BZCLH
        UUID: AF399A1C-0C8C-11E4-B599-40F2E92D9F02
        Wake-up Type: Power Switch
        SKU Number: Not Specified
        Family: System X

 

二、查看Raid组磁盘状态,SN等  (需要安装MegaCli ,下载地址:http://pan.baidu.com/s/1i4W6ERb )

1、查看磁盘raid卡厂商

# dmesg | grep -i raid
megaraid_sas 0000:16:00.0: PCI INT A -> GSI 34 (level, low) -> IRQ 34
megaraid_sas 0000:16:00.0: setting latency timer to 64
megaraid_sas 0000:16:00.0: irq 89 for MSI/MSI-X
scsi0 : LSI SAS based MegaRAID driver
scsi 0:0:0:0: Direct-Access     IBM      ServeRAID M5110e 3.34 PQ: 0 ANSI: 5
scsi 0:0:1:0: Direct-Access     IBM      ServeRAID M5110e 3.34 PQ: 0 ANSI: 5
scsi 0:2:0:0: Direct-Access     IBM      ServeRAID M5110e 3.34 PQ: 0 ANSI: 5
scsi 0:2:1:0: Direct-Access     IBM      ServeRAID M5110e 3.34 PQ: 0 ANSI: 5
md: Autodetecting RAID arrays.

 

 

2、查看磁盘物理信息

# /opt/MegaRAID/MegaCli/MegaCli64  -PDList -aAll
                                     
Adapter #0

Enclosure Device ID: 8
Slot Number: 0
Drives postion: DiskGroup: 0, Span: 0, Arm: 0
Enclosure position: 0
Device Id: 22
WWN: 5000C500725C991C
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.464 GB [0x22cee000 Sectors]
Firmware state: Online, Spun Up           ---磁盘状态
Is Commissioned Spare : NO
Device Firmware Level: B56M
Shield Counter: 0
Successful diagnostics completion on :  N/A
SAS Address(0): 0x5000c500725c991d
SAS Address(1): 0x0
Connected Port Number: 0(path0) 
Inquiry Data: IBM-ESXSST300MM0006     B56MS0K29RW30221B5C5    
IBM FRU/CRU: 41Y8376       ----磁盘SN     
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 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
Drives write cache : Enabled
Port-0 :
Port status: Active
Ports Linkspeed: 6.0Gb/s 
Port-1 :
Port status: Active
Ports Linkspeed: 6.0Gb/s 
Drive has flagged a S.M.A.R.T alert : No

...
...
...

Enclosure Device ID: 8
Slot Number: 3
Drives postion: DiskGroup: 0, Span: 1, Arm: 1
Enclosure position: 0
Device Id: 12
WWN: 5000CCA0542353E3
Sequence Number: 4
Media Error Count: 0
Other Error Count: 330           
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.464 GB [0x22cee000 Sectors]
Firmware state: Failed              ----磁盘状态             
Device Firmware Level: J2EG
Shield Counter: 0
Successful diagnostics completion on :  N/A
SAS Address(0): 0x5000cca0542353e1
SAS Address(1): 0x0
Connected Port Number: 0(path0) 
Inquiry Data: IBM-ESXSHUC109030CSS60  J2EGKFGME97RJ2EGJ2EGJ2EG
IBM FRU/CRU: 90Y8878           --磁盘FRU
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 Temperature :31C (87.80 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
Drives write cache : Enabled
Port-0 :
Port status: Active
Ports Linkspeed: 6.0Gb/s 
Port-1 :
Port status: Active
Ports Linkspeed: 6.0Gb/s 
Drive has flagged a S.M.A.R.T alert : No

...
...
...

 

 

3、查看所有Virtual Disk的状态(可以查看到raid级别,每个raid对应的硬盘)

RAID Level对应关系:

RAID Level : Primary-1, Secondary-0, RAID Level Qualifier-0 RAID 1
RAID Level : Primary-0, Secondary-0, RAID Level Qualifier-0 RAID 0
RAID Level : Primary-5, Secondary-0, RAID Level Qualifier-3 RAID 5
RAID Level : Primary-1, Secondary-3, RAID Level Qualifier-0 RAID 10

 

# /opt/MegaRAID/MegaCli/MegaCli64 -LdPdInfo -aAll -NoLog                            
                                     
Adapter #0

Number of Virtual Disks: 2
Virtual Drive: 0 (Target Id: 0)
Name                :
RAID Level          : Primary-1, Secondary-0, RAID Level Qualifier-0
Size                : 1.086 TB
Mirror Data         : 1.086 TB
State               : Optimal
Strip Size          : 128 KB
Number Of Drives per span:2
Span Depth          : 4
Default Cache Policy: WriteBack, ReadAhead, Cached, No Write Cache if Bad BBU
Current Cache Policy: WriteBack, ReadAhead, 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:  Proprietary type

Is VD Cached: No
Number of Spans: 4
Span: 0 - Number of PDs: 2

PD: 0 Information
Enclosure Device ID: 8
Slot Number: 0
Drives postion: DiskGroup: 0, Span: 0, Arm: 0
Enclosure position: 0
Device Id: 22
WWN: 5000C500725C991C
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.464 GB [0x22cee000 Sectors]
Firmware state: Online, Spun Up
Is Commissioned Spare : NO
Device Firmware Level: B56M
Shield Counter: 0
Successful diagnostics completion on :  N/A
SAS Address(0): 0x5000c500725c991d
SAS Address(1): 0x0
Connected Port Number: 0(path0) 
Inquiry Data: IBM-ESXSST300MM0006     B56MS0K29RW30221B5C5    
IBM FRU/CRU: 41Y8376     
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 Temperature :30C (86.00 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
Drives write cache : Enabled
Port-0 :
Port status: Active
Ports Linkspeed: 6.0Gb/s 
Port-1 :
Port status: Active
Ports Linkspeed: 6.0Gb/s 
Drive has flagged a S.M.A.R.T alert : No




PD: 1 Information
Enclosure Device ID: 8
Slot Number: 1
Drives postion: DiskGroup: 0, Span: 0, Arm: 1
Enclosure position: 0
Device Id: 21
WWN: 5000C50075E5DD88
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.464 GB [0x22cee000 Sectors]
Firmware state: Online, Spun Up
Is Commissioned Spare : NO
Device Firmware Level: B56M
Shield Counter: 0
Successful diagnostics completion on :  N/A
SAS Address(0): 0x5000c50075e5dd89
SAS Address(1): 0x0
Connected Port Number: 0(path0) 
Inquiry Data: IBM-ESXSST300MM0006     B56MS0K2DX3J0221B5C5    
IBM FRU/CRU: 41Y8376     
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 Temperature :30C (86.00 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
Drives write cache : Enabled
Port-0 :
Port status: Active
Ports Linkspeed: 6.0Gb/s 
Port-1 :
Port status: Active
Ports Linkspeed: 6.0Gb/s 
Drive has flagged a S.M.A.R.T alert : No
...
...
...



Virtual Drive: 1 (Target Id: 1)
Name                :
RAID Level          : Primary-1, Secondary-0, RAID Level Qualifier-0
Size                : 1.816 TB
Mirror Data         : 1.816 TB
State               : Optimal
Strip Size          : 256 KB
Number Of Drives per span:2
Span Depth          : 2
Default Cache Policy: WriteBack, ReadAhead, Cached, No Write Cache if Bad BBU
Current Cache Policy: WriteBack, ReadAhead, 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:  Proprietary type

Is VD Cached: No
Number of Spans: 2
Span: 0 - Number of PDs: 2

PD: 0 Information
Enclosure Device ID: 8
Slot Number: 8
Drives postion: DiskGroup: 1, Span: 0, Arm: 0
Enclosure position: 0
Device Id: 17
WWN: 5000C50058D8AD00
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: 931.512 GB [0x74706db0 Sectors]
Non Coerced Size: 931.012 GB [0x74606db0 Sectors]
Coerced Size: 930.390 GB [0x744c8000 Sectors]
Firmware state: Online, Spun Up
Is Commissioned Spare : NO
Device Firmware Level: BD2H
Shield Counter: 0
Successful diagnostics completion on :  N/A
SAS Address(0): 0x5000c50058d8ad01
SAS Address(1): 0x0
Connected Port Number: 0(path0) 
Inquiry Data: IBM-ESXSST91000640SS    BD2H9XG6Y2F01119BD31    
IBM FRU/CRU: 81Y9691     
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 Temperature :33C (91.40 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
Drives write cache : Enabled
Port-0 :
Port status: Active
Ports Linkspeed: 6.0Gb/s 
Port-1 :
Port status: Active
Ports Linkspeed: 6.0Gb/s 
Drive has flagged a S.M.A.R.T alert : No




PD: 1 Information
Enclosure Device ID: 8
Slot Number: 9
Drives postion: DiskGroup: 1, Span: 0, Arm: 1
Enclosure position: 0
Device Id: 19
WWN: 5000C50058D278CC
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: 931.512 GB [0x74706db0 Sectors]
Non Coerced Size: 931.012 GB [0x74606db0 Sectors]
Coerced Size: 930.390 GB [0x744c8000 Sectors]
Firmware state: Online, Spun Up
Is Commissioned Spare : NO
Device Firmware Level: BD2H
Shield Counter: 0
Successful diagnostics completion on :  N/A
SAS Address(0): 0x5000c50058d278cd
SAS Address(1): 0x0
Connected Port Number: 0(path0) 
Inquiry Data: IBM-ESXSST91000640SS    BD2H9XG6XGAD1119BD31    
IBM FRU/CRU: 81Y9691     
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 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
Drives write cache : Enabled
Port-0 :
Port status: Active
Ports Linkspeed: 6.0Gb/s 
Port-1 :
Port status: Active
Ports Linkspeed: 6.0Gb/s 
Drive has flagged a S.M.A.R.T alert : No


...
...
...
Exit Code: 0x00

或者只查看raid级别

# /opt/MegaRAID/MegaCli/MegaCli64 -LDInfo -Lall -aALL
                                     

Adapter 0 -- Virtual Drive Information:
Virtual Drive: 0 (Target Id: 0)
Name                :
RAID Level          : Primary-1, Secondary-0, RAID Level Qualifier-0
Size                : 1.086 TB
Mirror Data         : 1.086 TB
State               : Optimal
Strip Size          : 128 KB
Number Of Drives per span:2
Span Depth          : 4
Default Cache Policy: WriteBack, ReadAhead, Cached, No Write Cache if Bad BBU
Current Cache Policy: WriteBack, ReadAhead, 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:  Proprietary type

Is VD Cached: No


Virtual Drive: 1 (Target Id: 1)
Name                :
RAID Level          : Primary-1, Secondary-0, RAID Level Qualifier-0
Size                : 1.816 TB
Mirror Data         : 1.816 TB
State               : Optimal
Strip Size          : 256 KB
Number Of Drives per span:2
Span Depth          : 2
Default Cache Policy: WriteBack, ReadAhead, Cached, No Write Cache if Bad BBU
Current Cache Policy: WriteBack, ReadAhead, 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:  Proprietary type

Is VD Cached: No



Exit Code: 0x00

 

3.在线做Raid

/opt/MegaRAID/MegaCli/MegaCli64 -CfgLdAdd -r0[0:11] WB NORA Direct CachedBadBBU -strpsz64 -a0 -NoLog
/opt/MegaRAID/MegaCli/MegaCli64 -CfgLdAdd -r5 [12:2,12:3,12:4,12:5,12:6,12:7] WB Direct -a0

 

 

4.点亮指定硬盘(定位)

/opt/MegaRAID/MegaCli/MegaCli64 -PdLocate -start -physdrv[252:2] -a0

 

 

5.清除Foreign状态

/opt/MegaRAID/MegaCli/MegaCli64 -CfgForeign -Clear -a0

 

 

6.查看RAID阵列中掉线的盘

/opt/MegaRAID/MegaCli/MegaCli64 -pdgetmissing -a0

 

 

7.替换坏掉的模块

/opt/MegaRAID/MegaCli/MegaCli64 -pdreplacemissing -physdrv[12:10] -Array5 -row0 -a0

 

 

8.手动开启rebuid

/opt/MegaRAID/MegaCli/MegaCli64 -pdrbld -start -physdrv[12:10] -a0

 

 

9.查看Megacli的log

/opt/MegaRAID/MegaCli/MegaCli64 -FwTermLog dsply -a0 > adp2.log

10.设置HotSpare

/opt/MegaRAID/MegaCli/MegaCli64 -pdhsp -set [-Dedicated [-Array2]] [-EnclAffinity] [-nonRevertible] -PhysDrv[4:11] -a0
/opt/MegaRAID/MegaCli/MegaCli64 -pdhsp -set [-EnclAffinity] [-nonRevertible] -PhysDrv[321}] -a0

11.关闭Rebuild

/opt/MegaRAID/MegaCli/MegaCli64 -AdpAutoRbld -Dsbl -a0

12.设置rebuild的速率

/opt/MegaRAID/MegaCli/MegaCli64 -AdpSetProp RebuildRate -30 -a0

 

13.查看某块磁盘重构进度

#/opt/MegaRAID/MegaCli/MegaCli64 -PDRbld -ShowProg -PhysDrv [1:5] -a0

查看服务器型号、SN、Raid等信息