MegaCli使用方法


JBOD

​ 一天小明做了個系統,要裝ceph,也許是Raid卡不支持JBOD,就只能做Raid0咯,表面看着好像沒區別,大佬還會跟你講做Raid0有毛線用,我在想也許他還不知道Ceph是替代什么的吧,像我這種小白,連JBOD是什么都不知道,(之前Cisco UCS 做Raid的時候看到過這個選項)。

mark

​JBOD是存儲領域中一類重要的存儲設備,Low點的說法叫Raid卡直通,Just a Bunch Of Disks是JBOD的全名,奧,JBOD真的是只是一堆盤的縮寫,23333。

​如果已經安裝完系統,並且沒有配置JBOD 而是做了RAID 插入新磁盤, 系統是看不到的,但是有些業務是不能重啟的 ,但是你還想加盤,這就需要Megacli來搞事情了。

安裝MegaCli

下載並安裝

wegt https://docs.broadcom.com/docs-and-downloads/raid-controllers/raid-controllers-common-files/8-07-10_MegaCLI_Linux.zip
unzip 8-07-10_MegaCLI_Linux.zip 
yum localinstall 8.07.10_MegaCLI_Linux/Linux\ MegaCLI\ 8.07.10/MegaCli-8.07.10-1.noarch.rpm

目錄根據情況修改

我們看下都生成了什么!!

rpm -ql  rpm -ql MegaCli
/opt/MegaRAID/MegaCli/MegaCli
/opt/MegaRAID/MegaCli/MegaCli64
/opt/MegaRAID/MegaCli/libstorelibir-2.so.14.07-0

/opt/MegaRAID/MegaCli/MegaCli64這個文件就是我們要用到的,

Megacli概念

適配器,物理驅動器和虛擬驅動器

在我們通過megacli命令之前,我們需要遵循megacli概念。

適配器 - 我們要使用的物理控制器,由id(通常為0)表示。

機櫃 - 物理機箱所附的物理驅動器,以id為代表,例如254,252等。

物理驅動器 - 附加到控制器的物理硬盤,由id,0,1,2,3等代表

虛擬驅動器 - 這些驅動器包含物理驅動器,並等同於由id,0,1,2,3等代表的RAID設備。

例如,如果我們的RAID 0超過3個物理驅動器,我們得到:

物理驅動器ID:0,1,2

虛擬驅動器ID:0

虛擬驅動器包含物理驅動器0,1和2,並包括突襲設備的設置,如RAID級別,條帶大小等。

我們可以通過一個物理驅動器看到具有RAID 0的虛擬驅動器中的配置,我們有這種設置,因為物理驅動器連接到RAID控制器,並且為了將設備表示給系統,我們必須將其設置為兆位。

默認情況下,我們將在RAID 0中看到虛擬驅動器的所有物理設備。

獲取RAID控制器信息

使用lspci確保您的服務器已連接到RAID控制器。

 lspci | grep -i raid

我的輸出

03:00.0 RAID bus controller: LSI Logic / Symbios Logic MegaRAID SAS 2208 [Thunderbolt] (rev 05)

這表明我這存在MegaRaid controller ;我可以愉快的使用MegaCli搞事!

獲取RAID適配器的信息

 /opt/MegaRAID/MegaCli/MegaCli64  -AdpGetPciInfo -aAll

帶上路徑執行

我的輸出

PCI information for Controller 0
--------------------------------
Bus Number      : 23c0
Device Number   : 0
Function Number : a0


Exit Code: 0x00

這里看到適配器信息,適配器id為0。

獲取硬盤背板信息

/opt/MegaRAID/MegaCli/MegaCli64 -EncInfo -a0

我的輸出

                                     
    Number of enclosures on adapter 0 -- 1

    Enclosure 0:
    Device ID                     : 252
    Number of Slots               : 8
    Number of Power Supplies      : 0
    Number of Fans                : 0
    Number of Temperature Sensors : 0
    Number of Alarms              : 0
    Number of SIM Modules         : 1
    Number of Physical Drives     : 8
    Status                        : Normal
    Position                      : 1
    Connector Name                : Unavailable
    Enclosure type                : SGPIO
    FRU Part Number               : N/A
    Enclosure Serial Number       : N/A 
    ESM Serial Number             : N/A 
    Enclosure Zoning Mode         : N/A 
    Partner Device Id             : Unavailable

    Inquiry data                  :
        Vendor Identification     : LSI     
        Product Identification    : SGPIO           
        Product Revision Level    : N/A 
        Vendor Specific           :                     


Exit Code: 0x00

記錄下

Device ID 252
Number of Slots( 可以連接到這個背板的最大物理驅動器 8

獲取物理驅動器的信息

/opt/MegaRAID/MegaCli/MegaCli64 -LdPdInfo -a0

因為我的盤比較多。這里輸出就列出一個

PD: 0 Information
Enclosure Device ID: 252
Slot Number: 1
Drive's position: DiskGroup: 1, Span: 0, Arm: 0
Enclosure position: N/A
Device Id: 3
WWN: 500003963820BFE1
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): 0x500003963820bfe2
SAS Address(1): 0x0
Connected Port Number: 1(path0) 
Inquiry Data: TOSHIBA AL13SEB300      100445O0A05KFWC9        
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 :24C (75.20 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



Virtual Drive: 2 (Target Id: 2)
Name                :
RAID Level          : Primary-0, Secondary-0, RAID Level Qualifier-0
Size                : 278.875 GB
Sector Size         : 512
Is VD emulated      : No
Parity Size         : 0
State               : Optimal
Strip Size          : 256 KB
Number Of Drives    : 1
Span Depth          : 1
Default Cache Policy: WriteThrough, ReadAhead, Direct, No Write Cache if Bad BBU
Current Cache Policy: WriteThrough, ReadAhead, Direct, No Write Cache if Bad BBU
Default Access Policy: Read/Write
Current Access Policy: Read/Write
Disk Cache Policy   : Disk's Default
Encryption Type     : None
PI type: No PI

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

PD: 0 Information
Enclosure Device ID: 252
Slot Number: 3
Drive's position: DiskGroup: 2, Span: 0, Arm: 0
Enclosure position: N/A
Device Id: 14
WWN: 500003963820C81D
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): 0x500003963820c81e
SAS Address(1): 0x0
Connected Port Number: 3(path0) 
Inquiry Data: TOSHIBA AL13SEB300      100445O0A08RFWC9        
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 :26C (78.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



Virtual Drive: 3 (Target Id: 3)
Name                :
RAID Level          : Primary-0, Secondary-0, RAID Level Qualifier-0
Size                : 278.875 GB
Sector Size         : 512
Is VD emulated      : No
Parity Size         : 0
State               : Optimal
Strip Size          : 256 KB
Number Of Drives    : 1
Span Depth          : 1
Default Cache Policy: WriteThrough, ReadAhead, Direct, No Write Cache if Bad BBU
Current Cache Policy: WriteThrough, ReadAhead, Direct, No Write Cache if Bad BBU
Default Access Policy: Read/Write
Current Access Policy: Read/Write
Disk Cache Policy   : Disk's Default
Encryption Type     : None
PI type: No PI

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

PD: 0 Information
Enclosure Device ID: 252
Slot Number: 2
Drive's position: DiskGroup: 3, Span: 0, Arm: 0
Enclosure position: N/A
Device Id: 16
WWN: 500003963820C225
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): 0x500003963820c226
SAS Address(1): 0x0
Connected Port Number: 2(path0) 
Inquiry Data: TOSHIBA AL13SEB300      100445O0A06AFWC9        
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 :26C (78.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



Virtual Drive: 4 (Target Id: 4)
Name                :
RAID Level          : Primary-0, Secondary-0, RAID Level Qualifier-0
Size                : 837.843 GB
Sector Size         : 512
Is VD emulated      : No
Parity Size         : 0
State               : Optimal
Strip Size          : 256 KB
Number Of Drives    : 1
Span Depth          : 1
Default Cache Policy: WriteThrough, ReadAhead, Direct, No Write Cache if Bad BBU
Current Cache Policy: WriteThrough, ReadAhead, Direct, No Write Cache if Bad BBU
Default Access Policy: Read/Write
Current Access Policy: Read/Write
Disk Cache Policy   : Disk's Default
Encryption Type     : None
PI type: No PI

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

PD: 0 Information
Enclosure Device ID: 252
Slot Number: 4
Drive's position: DiskGroup: 4, Span: 0, Arm: 0
Enclosure position: N/A
Device Id: 15
WWN: 5000C500958D1EB8
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: 838.362 GB [0x68cb9e30 Sectors]
Non Coerced Size: 837.862 GB [0x68bb9e30 Sectors]
Coerced Size: 837.843 GB [0x68bb0000 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: L56Q
Shield Counter: 0
Successful diagnostics completion on :  N/A
SAS Address(0): 0x5000c500958d1eb9
SAS Address(1): 0x0
Connected Port Number: 4(path0) 
Inquiry Data: LENOVO-XST900MM0006     L56QS0N5129S0521B5C9    
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 :28C (82.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
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



Virtual Drive: 5 (Target Id: 5)
Name                :
RAID Level          : Primary-0, Secondary-0, RAID Level Qualifier-0
Size                : 278.875 GB
Sector Size         : 512
Is VD emulated      : No
Parity Size         : 0
State               : Optimal
Strip Size          : 256 KB
Number Of Drives    : 1
Span Depth          : 1
Default Cache Policy: WriteBack, ReadAdaptive, Direct, No Write Cache if Bad BBU
Current Cache Policy: WriteThrough, ReadAdaptive, Direct, No Write Cache if Bad BBU
Default Access Policy: Read/Write
Current Access Policy: Read/Write
Disk Cache Policy   : Disk's Default
Encryption Type     : None
PI type: No PI

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

PD: 0 Information
Enclosure Device ID: 252
Slot Number: 5
Drive's position: DiskGroup: 5, Span: 0, Arm: 0
Enclosure position: N/A
Device Id: 18
WWN: 500003963820C429
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): 0x500003963820c42a
SAS Address(1): 0x0
Connected Port Number: 5(path0) 
Inquiry Data: TOSHIBA AL13SEB300      100445O0A06TFWC9        
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 :24C (75.20 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



Virtual Drive: 6 (Target Id: 6)
Name                :
RAID Level          : Primary-0, Secondary-0, RAID Level Qualifier-0
Size                : 278.875 GB
Sector Size         : 512
Is VD emulated      : No
Parity Size         : 0
State               : Optimal
Strip Size          : 256 KB
Number Of Drives    : 1
Span Depth          : 1
Default Cache Policy: WriteBack, ReadAdaptive, Direct, No Write Cache if Bad BBU
Current Cache Policy: WriteThrough, ReadAdaptive, Direct, No Write Cache if Bad BBU
Default Access Policy: Read/Write
Current Access Policy: Read/Write
Disk Cache Policy   : Disk's Default
Encryption Type     : None
PI type: No PI

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

PD: 0 Information
Enclosure Device ID: 252
Slot Number: 6
Drive's position: DiskGroup: 6, Span: 0, Arm: 0
Enclosure position: N/A
Device Id: 19
WWN: 500003963820BFF1
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): 0x500003963820bff2
SAS Address(1): 0x0
Connected Port Number: 6(path0) 
Inquiry Data: TOSHIBA AL13SEB300      100445O0A05MFWC9        
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 :24C (75.20 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



Virtual Drive: 7 (Target Id: 7)
Name                :
RAID Level          : Primary-0, Secondary-0, RAID Level Qualifier-0
Size                : 278.875 GB
Sector Size         : 512
Is VD emulated      : No
Parity Size         : 0
State               : Optimal
Strip Size          : 256 KB
Number Of Drives    : 1
Span Depth          : 1
Default Cache Policy: WriteBack, ReadAdaptive, Direct, No Write Cache if Bad BBU
Current Cache Policy: WriteThrough, ReadAdaptive, Direct, No Write Cache if Bad BBU
Default Access Policy: Read/Write
Current Access Policy: Read/Write
Disk Cache Policy   : Disk's Default
Encryption Type     : None
PI type: No PI

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

PD: 0 Information
Enclosure Device ID: 252
Slot Number: 7
Drive's position: DiskGroup: 7, Span: 0, Arm: 0
Enclosure position: N/A
Device Id: 20
WWN: 500003963820C2D1
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): 0x500003963820c2d2
SAS Address(1): 0x0
Connected Port Number: 7(path0) 
Inquiry Data: TOSHIBA AL13SEB300      100445O0A06HFWC9        
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 :24C (75.20 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




Exit Code: 0x00

Slot Number是物理驅動器連接的插槽號,也就是對應物理驅動器id

獲取Virtual drives信息

/opt/MegaRAID/MegaCli/MegaCli64  -LDInfo -Lall -a0

我的輸出

                                     

Adapter 0 -- Virtual Drive Information:
Virtual Drive: 0 (Target Id: 0)
Name                :
RAID Level          : Primary-0, Secondary-0, RAID Level Qualifier-0
Size                : 185.781 GB
Sector Size         : 512
Is VD emulated      : Yes
Parity Size         : 0
State               : Optimal
Strip Size          : 256 KB
Number Of Drives    : 1
Span Depth          : 1
Default Cache Policy: WriteThrough, ReadAhead, Direct, No Write Cache if Bad BBU
Current Cache Policy: WriteThrough, ReadAhead, Direct, 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


Virtual Drive: 1 (Target Id: 1)
Name                :
RAID Level          : Primary-0, Secondary-0, RAID Level Qualifier-0
Size                : 278.875 GB
Sector Size         : 512
Is VD emulated      : No
Parity Size         : 0
State               : Optimal
Strip Size          : 256 KB
Number Of Drives    : 1
Span Depth          : 1
Default Cache Policy: WriteThrough, ReadAhead, Direct, No Write Cache if Bad BBU
Current Cache Policy: WriteThrough, ReadAhead, Direct, No Write Cache if Bad BBU
Default Access Policy: Read/Write
Current Access Policy: Read/Write
Disk Cache Policy   : Disk's Default
Encryption Type     : None
PI type: No PI

Is VD Cached: No


Virtual Drive: 2 (Target Id: 2)
Name                :
RAID Level          : Primary-0, Secondary-0, RAID Level Qualifier-0
Size                : 278.875 GB
Sector Size         : 512
Is VD emulated      : No
Parity Size         : 0
State               : Optimal
Strip Size          : 256 KB
Number Of Drives    : 1
Span Depth          : 1
Default Cache Policy: WriteThrough, ReadAhead, Direct, No Write Cache if Bad BBU
Current Cache Policy: WriteThrough, ReadAhead, Direct, No Write Cache if Bad BBU
Default Access Policy: Read/Write
Current Access Policy: Read/Write
Disk Cache Policy   : Disk's Default
Encryption Type     : None
PI type: No PI

Is VD Cached: No


Virtual Drive: 3 (Target Id: 3)
Name                :
RAID Level          : Primary-0, Secondary-0, RAID Level Qualifier-0
Size                : 278.875 GB
Sector Size         : 512
Is VD emulated      : No
Parity Size         : 0
State               : Optimal
Strip Size          : 256 KB
Number Of Drives    : 1
Span Depth          : 1
Default Cache Policy: WriteThrough, ReadAhead, Direct, No Write Cache if Bad BBU
Current Cache Policy: WriteThrough, ReadAhead, Direct, No Write Cache if Bad BBU
Default Access Policy: Read/Write
Current Access Policy: Read/Write
Disk Cache Policy   : Disk's Default
Encryption Type     : None
PI type: No PI

Is VD Cached: No


Virtual Drive: 4 (Target Id: 4)
Name                :
RAID Level          : Primary-0, Secondary-0, RAID Level Qualifier-0
Size                : 837.843 GB
Sector Size         : 512
Is VD emulated      : No
Parity Size         : 0
State               : Optimal
Strip Size          : 256 KB
Number Of Drives    : 1
Span Depth          : 1
Default Cache Policy: WriteThrough, ReadAhead, Direct, No Write Cache if Bad BBU
Current Cache Policy: WriteThrough, ReadAhead, Direct, No Write Cache if Bad BBU
Default Access Policy: Read/Write
Current Access Policy: Read/Write
Disk Cache Policy   : Disk's Default
Encryption Type     : None
PI type: No PI

Is VD Cached: No


Virtual Drive: 5 (Target Id: 5)
Name                :
RAID Level          : Primary-0, Secondary-0, RAID Level Qualifier-0
Size                : 278.875 GB
Sector Size         : 512
Is VD emulated      : No
Parity Size         : 0
State               : Optimal
Strip Size          : 256 KB
Number Of Drives    : 1
Span Depth          : 1
Default Cache Policy: WriteBack, ReadAdaptive, Direct, No Write Cache if Bad BBU
Current Cache Policy: WriteThrough, ReadAdaptive, Direct, No Write Cache if Bad BBU
Default Access Policy: Read/Write
Current Access Policy: Read/Write
Disk Cache Policy   : Disk's Default
Encryption Type     : None
PI type: No PI

Is VD Cached: No


Virtual Drive: 6 (Target Id: 6)
Name                :
RAID Level          : Primary-0, Secondary-0, RAID Level Qualifier-0
Size                : 278.875 GB
Sector Size         : 512
Is VD emulated      : No
Parity Size         : 0
State               : Optimal
Strip Size          : 256 KB
Number Of Drives    : 1
Span Depth          : 1
Default Cache Policy: WriteBack, ReadAdaptive, Direct, No Write Cache if Bad BBU
Current Cache Policy: WriteThrough, ReadAdaptive, Direct, No Write Cache if Bad BBU
Default Access Policy: Read/Write
Current Access Policy: Read/Write
Disk Cache Policy   : Disk's Default
Encryption Type     : None
PI type: No PI

Is VD Cached: No


Virtual Drive: 7 (Target Id: 7)
Name                :
RAID Level          : Primary-0, Secondary-0, RAID Level Qualifier-0
Size                : 278.875 GB
Sector Size         : 512
Is VD emulated      : No
Parity Size         : 0
State               : Optimal
Strip Size          : 256 KB
Number Of Drives    : 1
Span Depth          : 1
Default Cache Policy: WriteBack, ReadAdaptive, Direct, No Write Cache if Bad BBU
Current Cache Policy: WriteThrough, ReadAdaptive, Direct, No Write Cache if Bad BBU
Default Access Policy: Read/Write
Current Access Policy: Read/Write
Disk Cache Policy   : Disk's Default
Encryption Type     : None
PI type: No PI

Is VD Cached: No



Exit Code: 0x00
Target ID 表RAID創建過程中 創建的虛擬驅動器
Size RAID設備的大小,這個大小是實際可分配的大小

獲取Virtual drives內的物理驅動器信息

這就有點難了, 其實沒什么卵用,記下來留着以后copy

/opt/MegaRAID/MegaCli/MegaCli64  -LdPdInfo -a0 | grep -E "Virtual Drive:|Slot Number:" | xargs | sed -r 's/(Slot Number:)(\s[0-9]+)/\2,/g' | sed 's/(Target Id: .)/Physical Drives ids:/g' | sed 's/Virtual Drive:/\nVirtual Drive:/g'

我的輸出

Virtual Drive: 0 Physical Drives ids:  0, 
Virtual Drive: 1 Physical Drives ids:  1, 
Virtual Drive: 2 Physical Drives ids:  3, 
Virtual Drive: 3 Physical Drives ids:  2, 
Virtual Drive: 4 Physical Drives ids:  4, 
Virtual Drive: 5 Physical Drives ids:  5, 
Virtual Drive: 6 Physical Drives ids:  6, 
Virtual Drive: 7 Physical Drives ids:  7,

或者使用這個工具 "megasasctl"

創建RAID設備(Virtual drives)

前面主要是收集信息,有信息,才可以准確的創建

比如我們來一個

Adpater id: 0
Enclosure id: 252
Physical Drive ids: 3
Raid Level: 0

命令參數

/opt/MegaRAID/MegaCli/MegaCli64 -CfgLdAdd -rX[enclosure_id:physical_id,enclosure_id:physical_id] -aN

X 是 RAID級別

N 是 adapter ID

舉個栗子

/opt/MegaRAID/MegaCli/MegaCli64  -CfgLdAdd -r0[252:3,252:4] -a0

設備編號為3和4的磁盤,創建RAID0

來個RAID10

/opt/MegaRAID/MegaCli/MegaCli64 -CfgSpanAdd -r10 -Array0 [252:2,252:3] -Array1 [252:4,252:5] -a0

刪除RAID設備

刪Virtual drives2

/opt/MegaRAID/MegaCli/MegaCli64 -CfgLdDel -L2 -a0

常用選項

相關命令及其解析: 
查看機器型號    # dmidecode | grep "Product" 
查看廠商    # dmidecode| grep  "Manufacturer" 
查看序列號    # dmidecode | grep  "Serial Number" 
查看CPU信息    # dmidecode | grep  "CPU" 
查看CPU個數    # dmidecode | grep  "Socket Designation: CPU" |wc –l 
查看出廠日期    # dmidecode | grep "Date" 
查看充電狀態    # MegaCli -AdpBbuCmd -GetBbuStatus -aALL |grep "Charger Status" 
顯示BBU狀態信息    # MegaCli -AdpBbuCmd -GetBbuStatus –aALL 
顯示BBU容量信息    # MegaCli -AdpBbuCmd -GetBbuCapacityInfo –aALL 
顯示BBU設計參數    # MegaCli -AdpBbuCmd -GetBbuDesignInfo –aALL 
顯示當前BBU屬性    # MegaCli -AdpBbuCmd -GetBbuProperties –aALL 
查看充電進度百分比    # MegaCli -AdpBbuCmd -GetBbuStatus -aALL |grep "Relative State of Charge" 
查詢Raid陣列數    # MegaCli -cfgdsply -aALL |grep "Number of DISK GROUPS:" 
顯示Raid卡型號,Raid設置,Disk相關信息      # MegaCli -cfgdsply –aALL 
顯示所有物理信息    # MegaCli -PDList -aALL 
顯示所有邏輯磁盤組信息    # MegaCli -LDInfo -LALL –aAll 
查看物理磁盤重建進度(重要)    # MegaCli -PDRbld -ShowProg -PhysDrv [1:5] -a0 
查看適配器個數    #MegaCli –adpCount 
查看適配器時間    #MegaCli -AdpGetTime –aALL 
顯示所有適配器信息    #MegaCli -AdpAllInfo –aAll 
查看Cache 策略設置    # MegaCli -cfgdsply -aALL |grep Polic

硬盤方面:

1、查看所有物理磁盤信息 
MegaCli -PDList -aALL


2、查看磁盤緩存策略 
MegaCli -LDGetProp -Cache -L0 -a0
or 
MegaCli -LDGetProp -Cache -L1 -a0
or 
MegaCli -LDGetProp -Cache -LALL -a0
or 
MegaCli -LDGetProp -Cache -LALL -aALL
or 
MegaCli -LDGetProp -DskCache -LALL -aALL

3、設置磁盤緩存策略 
緩存策略解釋: 
WT    (Write through 
WB    (Write back) 
NORA  (No read ahead) 
RA    (Read ahead) 
ADRA  (Adaptive read ahead) 
Cached 
Direct 
例子: 
MegaCli -LDSetProp WT|WB|NORA|RA|ADRA -L0 -a0 
or 
MegaCli -LDSetProp -Cached|-Direct -L0 -a0 
or 
enable / disable disk cache 
MegaCli -LDSetProp -EnDskCache|-DisDskCache -L0 -a0 
4、創建/刪除 陣列 
    4.1 創建一個 raid5 陣列,由物理盤 2,3,4 構成,該陣列的熱備盤是物理盤 5 
MegaCli -CfgLdAdd -r5 [1:2,1:3,1:4] WB Direct -Hsp[1:5] –a0 
    4.2 創建陣列,不指定熱備 
MegaCli -CfgLdAdd -r5 [1:2,1:3,1:4] WB Direct –a0 
    4.3 刪除陣列 
MegaCli -CfgLdDel -L1 –a0 
    4.4 在線添加磁盤 
MegaCli -LDRecon -Start -r5 -Add -PhysDrv[1:4] -L1 -a0 
意思是,重建邏輯磁盤組1,raid級別是5,添加物理磁盤號:1:4。重建完后,新添加的物理磁盤會自動處於重建(同步)狀態,這個 時候 fdisk -l是看不到陣列的空間變大的,只有在系統重啟后才能看見。 
5、查看陣列初始化信息 
    5.1 陣列創建完后,會有一個初始化同步塊的過程,可以看看其進度。 
MegaCli -LDInit -ShowProg -LALL -aALL 
或者以動態可視化文字界面顯示 
MegaCli -LDInit -ProgDsply -LALL –aALL 
    5.2 查看陣列后台初始化進度 
MegaCli -LDBI -ShowProg -LALL -aALL 
或者以動態可視化文字界面顯示 
MegaCli -LDBI -ProgDsply -LALL -aALL 
6、創建全局熱備 
指定第 5 塊盤作為全局熱備 
MegaCli -PDHSP -Set [-EnclAffinity] [-nonRevertible] -PhysDrv[1:5] -a0 
也可以指定為某個陣列的專用熱備 
MegaCli -PDHSP -Set [-Dedicated [-Array1]] [-EnclAffinity] [-nonRevertible] -PhysDrv[1:5] -a0 
7、刪除全局熱備 
MegaCli -PDHSP -Rmv -PhysDrv[1:5] -a0 
8、將某塊物理盤下線/上線 
MegaCli -PDOffline -PhysDrv [1:4] -a0 
MegaCli -PDOnline -PhysDrv [1:4] -a0 
9、查看物理磁盤重建進度 
MegaCli -PDRbld -ShowProg -PhysDrv [1:5] -a0


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM