博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
MegaCli使用方法
阅读量:4354 次
发布时间:2019-06-07

本文共 25239 字,大约阅读时间需要 84 分钟。

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.zipunzip 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      : 23c0Device Number   : 0Function Number : a0Exit 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 InformationEnclosure Device ID: 252Slot Number: 1Drive's position: DiskGroup: 1, Span: 0, Arm: 0Enclosure position: N/ADevice Id: 3WWN: 500003963820BFE1Sequence Number: 2Media Error Count: 0Other Error Count: 0Predictive Failure Count: 0Last Predictive Failure Event Seq Number: 0PD Type: SASRaw Size: 279.396 GB [0x22ecb25c Sectors]Non Coerced Size: 278.896 GB [0x22dcb25c Sectors]Coerced Size: 278.875 GB [0x22dc0000 Sectors]Sector Size:  512Logical Sector Size:  512Physical Sector Size:  512Firmware state: Online, Spun UpCommissioned Spare : NoEmergency Spare : NoDevice Firmware Level: 1004Shield Counter: 0Successful diagnostics completion on :  N/ASAS Address(0): 0x500003963820bfe2SAS Address(1): 0x0Connected Port Number: 1(path0) Inquiry Data: TOSHIBA AL13SEB300      100445O0A05KFWC9        FDE Capable: Not CapableFDE Enable: DisableSecured: UnsecuredLocked: UnlockedNeeds EKM Attention: NoForeign State: None Device Speed: 6.0Gb/s Link Speed: 6.0Gb/s Media Type: Hard Disk DeviceDrive:  Not CertifiedDrive Temperature :24C (75.20 F)PI Eligibility:  No Drive is formatted for PI information:  NoPI: No PIPort-0 :Port status: ActivePort's Linkspeed: 6.0Gb/s Port-1 :Port status: ActivePort's Linkspeed: 6.0Gb/s Drive has flagged a S.M.A.R.T alert : NoVirtual Drive: 2 (Target Id: 2)Name                :RAID Level          : Primary-0, Secondary-0, RAID Level Qualifier-0Size                : 278.875 GBSector Size         : 512Is VD emulated      : NoParity Size         : 0State               : OptimalStrip Size          : 256 KBNumber Of Drives    : 1Span Depth          : 1Default Cache Policy: WriteThrough, ReadAhead, Direct, No Write Cache if Bad BBUCurrent Cache Policy: WriteThrough, ReadAhead, Direct, No Write Cache if Bad BBUDefault Access Policy: Read/WriteCurrent Access Policy: Read/WriteDisk Cache Policy   : Disk's DefaultEncryption Type     : NonePI type: No PIIs VD Cached: NoNumber of Spans: 1Span: 0 - Number of PDs: 1PD: 0 InformationEnclosure Device ID: 252Slot Number: 3Drive's position: DiskGroup: 2, Span: 0, Arm: 0Enclosure position: N/ADevice Id: 14WWN: 500003963820C81DSequence Number: 2Media Error Count: 0Other Error Count: 0Predictive Failure Count: 0Last Predictive Failure Event Seq Number: 0PD Type: SASRaw Size: 279.396 GB [0x22ecb25c Sectors]Non Coerced Size: 278.896 GB [0x22dcb25c Sectors]Coerced Size: 278.875 GB [0x22dc0000 Sectors]Sector Size:  512Logical Sector Size:  512Physical Sector Size:  512Firmware state: Online, Spun UpCommissioned Spare : NoEmergency Spare : NoDevice Firmware Level: 1004Shield Counter: 0Successful diagnostics completion on :  N/ASAS Address(0): 0x500003963820c81eSAS Address(1): 0x0Connected Port Number: 3(path0) Inquiry Data: TOSHIBA AL13SEB300      100445O0A08RFWC9        FDE Capable: Not CapableFDE Enable: DisableSecured: UnsecuredLocked: UnlockedNeeds EKM Attention: NoForeign State: NoneDevice Speed: 6.0Gb/sLink Speed: 6.0Gb/sMedia Type: Hard Disk DeviceDrive:  Not CertifiedDrive Temperature :26C (78.80 F)PI Eligibility:  NoDrive is formatted for PI information:  NoPI: No PIPort-0 :Port status: ActivePort's Linkspeed: 6.0Gb/sPort-1 :Port status: ActivePort's Linkspeed: 6.0Gb/sDrive has flagged a S.M.A.R.T alert : NoVirtual Drive: 3 (Target Id: 3)Name                :RAID Level          : Primary-0, Secondary-0, RAID Level Qualifier-0Size                : 278.875 GBSector Size         : 512Is VD emulated      : NoParity Size         : 0State               : OptimalStrip Size          : 256 KBNumber Of Drives    : 1Span Depth          : 1Default Cache Policy: WriteThrough, ReadAhead, Direct, No Write Cache if Bad BBUCurrent Cache Policy: WriteThrough, ReadAhead, Direct, No Write Cache if Bad BBUDefault Access Policy: Read/WriteCurrent Access Policy: Read/WriteDisk Cache Policy   : Disk's DefaultEncryption Type     : NonePI type: No PIIs VD Cached: NoNumber of Spans: 1Span: 0 - Number of PDs: 1PD: 0 InformationEnclosure Device ID: 252Slot Number: 2Drive's position: DiskGroup: 3, Span: 0, Arm: 0Enclosure position: N/ADevice Id: 16WWN: 500003963820C225Sequence Number: 2Media Error Count: 0Other Error Count: 0Predictive Failure Count: 0Last Predictive Failure Event Seq Number: 0PD Type: SASRaw Size: 279.396 GB [0x22ecb25c Sectors]Non Coerced Size: 278.896 GB [0x22dcb25c Sectors]Coerced Size: 278.875 GB [0x22dc0000 Sectors]Sector Size:  512Logical Sector Size:  512Physical Sector Size:  512Firmware state: Online, Spun UpCommissioned Spare : NoEmergency Spare : NoDevice Firmware Level: 1004Shield Counter: 0Successful diagnostics completion on :  N/ASAS Address(0): 0x500003963820c226SAS Address(1): 0x0Connected Port Number: 2(path0) Inquiry Data: TOSHIBA AL13SEB300      100445O0A06AFWC9        FDE Capable: Not CapableFDE Enable: DisableSecured: UnsecuredLocked: UnlockedNeeds EKM Attention: NoForeign State: None Device Speed: 6.0Gb/s Link Speed: 6.0Gb/s Media Type: Hard Disk DeviceDrive:  Not CertifiedDrive Temperature :26C (78.80 F)PI Eligibility:  No Drive is formatted for PI information:  NoPI: No PIPort-0 :Port status: ActivePort's Linkspeed: 6.0Gb/sPort-1 :Port status: ActivePort's Linkspeed: 6.0Gb/s Drive has flagged a S.M.A.R.T alert : NoVirtual Drive: 4 (Target Id: 4)Name                :RAID Level          : Primary-0, Secondary-0, RAID Level Qualifier-0Size                : 837.843 GBSector Size         : 512Is VD emulated      : NoParity Size         : 0State               : OptimalStrip Size          : 256 KBNumber Of Drives    : 1Span Depth          : 1Default Cache Policy: WriteThrough, ReadAhead, Direct, No Write Cache if Bad BBUCurrent Cache Policy: WriteThrough, ReadAhead, Direct, No Write Cache if Bad BBUDefault Access Policy: Read/WriteCurrent Access Policy: Read/WriteDisk Cache Policy   : Disk's DefaultEncryption Type     : NonePI type: No PIIs VD Cached: NoNumber of Spans: 1Span: 0 - Number of PDs: 1PD: 0 InformationEnclosure Device ID: 252Slot Number: 4Drive's position: DiskGroup: 4, Span: 0, Arm: 0Enclosure position: N/ADevice Id: 15WWN: 5000C500958D1EB8Sequence Number: 2Media Error Count: 0Other Error Count: 0Predictive Failure Count: 0Last Predictive Failure Event Seq Number: 0PD Type: SASRaw Size: 838.362 GB [0x68cb9e30 Sectors]Non Coerced Size: 837.862 GB [0x68bb9e30 Sectors]Coerced Size: 837.843 GB [0x68bb0000 Sectors]Sector Size:  512Logical Sector Size:  512Physical Sector Size:  512Firmware state: Online, Spun UpCommissioned Spare : NoEmergency Spare : NoDevice Firmware Level: L56QShield Counter: 0Successful diagnostics completion on :  N/ASAS Address(0): 0x5000c500958d1eb9SAS Address(1): 0x0Connected Port Number: 4(path0) Inquiry Data: LENOVO-XST900MM0006     L56QS0N5129S0521B5C9    FDE Capable: Not CapableFDE Enable: DisableSecured: UnsecuredLocked: UnlockedNeeds EKM Attention: NoForeign State: None Device Speed: 6.0Gb/s Link Speed: 6.0Gb/s Media Type: Hard Disk DeviceDrive:  Not CertifiedDrive 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 2Port-0 :Port status: ActivePort's Linkspeed: 6.0Gb/sPort-1 :Port status: ActivePort's Linkspeed: 6.0Gb/s Drive has flagged a S.M.A.R.T alert : NoVirtual Drive: 5 (Target Id: 5)Name                :RAID Level          : Primary-0, Secondary-0, RAID Level Qualifier-0Size                : 278.875 GBSector Size         : 512Is VD emulated      : NoParity Size         : 0State               : OptimalStrip Size          : 256 KBNumber Of Drives    : 1Span Depth          : 1Default Cache Policy: WriteBack, ReadAdaptive, Direct, No Write Cache if Bad BBUCurrent Cache Policy: WriteThrough, ReadAdaptive, Direct, No Write Cache if Bad BBUDefault Access Policy: Read/WriteCurrent Access Policy: Read/WriteDisk Cache Policy   : Disk's DefaultEncryption Type     : NonePI type: No PIIs VD Cached: NoNumber of Spans: 1Span: 0 - Number of PDs: 1PD: 0 InformationEnclosure Device ID: 252Slot Number: 5Drive's position: DiskGroup: 5, Span: 0, Arm: 0Enclosure position: N/ADevice Id: 18WWN: 500003963820C429Sequence Number: 2Media Error Count: 0Other Error Count: 0Predictive Failure Count: 0Last Predictive Failure Event Seq Number: 0PD Type: SASRaw Size: 279.396 GB [0x22ecb25c Sectors]Non Coerced Size: 278.896 GB [0x22dcb25c Sectors]Coerced Size: 278.875 GB [0x22dc0000 Sectors]Sector Size:  512Logical Sector Size:  512Physical Sector Size:  512Firmware state: Online, Spun UpCommissioned Spare : NoEmergency Spare : NoDevice Firmware Level: 1004Shield Counter: 0Successful diagnostics completion on :  N/ASAS Address(0): 0x500003963820c42aSAS Address(1): 0x0Connected Port Number: 5(path0) Inquiry Data: TOSHIBA AL13SEB300      100445O0A06TFWC9        FDE Capable: Not CapableFDE Enable: DisableSecured: UnsecuredLocked: UnlockedNeeds EKM Attention: NoForeign State: None Device Speed: 6.0Gb/s Link Speed: 6.0Gb/s Media Type: Hard Disk DeviceDrive:  Not CertifiedDrive Temperature :24C (75.20 F)PI Eligibility:  No Drive is formatted for PI information:  NoPI: No PIPort-0 :Port status: ActivePort's Linkspeed: 6.0Gb/s Port-1 :Port status: ActivePort's Linkspeed: 6.0Gb/s Drive has flagged a S.M.A.R.T alert : NoVirtual Drive: 6 (Target Id: 6)Name                :RAID Level          : Primary-0, Secondary-0, RAID Level Qualifier-0Size                : 278.875 GBSector Size         : 512Is VD emulated      : NoParity Size         : 0State               : OptimalStrip Size          : 256 KBNumber Of Drives    : 1Span Depth          : 1Default Cache Policy: WriteBack, ReadAdaptive, Direct, No Write Cache if Bad BBUCurrent Cache Policy: WriteThrough, ReadAdaptive, Direct, No Write Cache if Bad BBUDefault Access Policy: Read/WriteCurrent Access Policy: Read/WriteDisk Cache Policy   : Disk's DefaultEncryption Type     : NonePI type: No PIIs VD Cached: NoNumber of Spans: 1Span: 0 - Number of PDs: 1PD: 0 InformationEnclosure Device ID: 252Slot Number: 6Drive's position: DiskGroup: 6, Span: 0, Arm: 0Enclosure position: N/ADevice Id: 19WWN: 500003963820BFF1Sequence Number: 2Media Error Count: 0Other Error Count: 0Predictive Failure Count: 0Last Predictive Failure Event Seq Number: 0PD Type: SASRaw Size: 279.396 GB [0x22ecb25c Sectors]Non Coerced Size: 278.896 GB [0x22dcb25c Sectors]Coerced Size: 278.875 GB [0x22dc0000 Sectors]Sector Size:  512Logical Sector Size:  512Physical Sector Size:  512Firmware state: Online, Spun UpCommissioned Spare : NoEmergency Spare : NoDevice Firmware Level: 1004Shield Counter: 0Successful diagnostics completion on :  N/ASAS Address(0): 0x500003963820bff2SAS Address(1): 0x0Connected Port Number: 6(path0) Inquiry Data: TOSHIBA AL13SEB300      100445O0A05MFWC9        FDE Capable: Not CapableFDE Enable: DisableSecured: UnsecuredLocked: UnlockedNeeds EKM Attention: NoForeign State: None Device Speed: 6.0Gb/s Link Speed: 6.0Gb/s Media Type: Hard Disk DeviceDrive:  Not CertifiedDrive Temperature :24C (75.20 F)PI Eligibility:  No Drive is formatted for PI information:  NoPI: No PIPort-0 :Port status: ActivePort's Linkspeed: 6.0Gb/s Port-1 :Port status: ActivePort's Linkspeed: 6.0Gb/s Drive has flagged a S.M.A.R.T alert : NoVirtual Drive: 7 (Target Id: 7)Name                :RAID Level          : Primary-0, Secondary-0, RAID Level Qualifier-0Size                : 278.875 GBSector Size         : 512Is VD emulated      : NoParity Size         : 0State               : OptimalStrip Size          : 256 KBNumber Of Drives    : 1Span Depth          : 1Default Cache Policy: WriteBack, ReadAdaptive, Direct, No Write Cache if Bad BBUCurrent Cache Policy: WriteThrough, ReadAdaptive, Direct, No Write Cache if Bad BBUDefault Access Policy: Read/WriteCurrent Access Policy: Read/WriteDisk Cache Policy   : Disk's DefaultEncryption Type     : NonePI type: No PIIs VD Cached: NoNumber of Spans: 1Span: 0 - Number of PDs: 1PD: 0 InformationEnclosure Device ID: 252Slot Number: 7Drive's position: DiskGroup: 7, Span: 0, Arm: 0Enclosure position: N/ADevice Id: 20WWN: 500003963820C2D1Sequence Number: 2Media Error Count: 0Other Error Count: 0Predictive Failure Count: 0Last Predictive Failure Event Seq Number: 0PD Type: SASRaw Size: 279.396 GB [0x22ecb25c Sectors]Non Coerced Size: 278.896 GB [0x22dcb25c Sectors]Coerced Size: 278.875 GB [0x22dc0000 Sectors]Sector Size:  512Logical Sector Size:  512Physical Sector Size:  512Firmware state: Online, Spun UpCommissioned Spare : NoEmergency Spare : NoDevice Firmware Level: 1004Shield Counter: 0Successful diagnostics completion on :  N/ASAS Address(0): 0x500003963820c2d2SAS Address(1): 0x0Connected Port Number: 7(path0) Inquiry Data: TOSHIBA AL13SEB300      100445O0A06HFWC9        FDE Capable: Not CapableFDE Enable: DisableSecured: UnsecuredLocked: UnlockedNeeds EKM Attention: NoForeign State: None Device Speed: 6.0Gb/s Link Speed: 6.0Gb/s Media Type: Hard Disk DeviceDrive:  Not CertifiedDrive Temperature :24C (75.20 F)PI Eligibility:  No Drive is formatted for PI information:  NoPI: No PIPort-0 :Port status: ActivePort's Linkspeed: 6.0Gb/s Port-1 :Port status: ActivePort's Linkspeed: 6.0Gb/s Drive has flagged a S.M.A.R.T alert : NoExit 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-0Size                : 185.781 GBSector Size         : 512Is VD emulated      : YesParity Size         : 0State               : OptimalStrip Size          : 256 KBNumber Of Drives    : 1Span Depth          : 1Default Cache Policy: WriteThrough, ReadAhead, Direct, No Write Cache if Bad BBUCurrent Cache Policy: WriteThrough, ReadAhead, Direct, No Write Cache if Bad BBUDefault Access Policy: Read/WriteCurrent Access Policy: Read/WriteDisk Cache Policy   : EnabledEncryption Type     : NonePI type: No PIIs VD Cached: NoVirtual Drive: 1 (Target Id: 1)Name                :RAID Level          : Primary-0, Secondary-0, RAID Level Qualifier-0Size                : 278.875 GBSector Size         : 512Is VD emulated      : NoParity Size         : 0State               : OptimalStrip Size          : 256 KBNumber Of Drives    : 1Span Depth          : 1Default Cache Policy: WriteThrough, ReadAhead, Direct, No Write Cache if Bad BBUCurrent Cache Policy: WriteThrough, ReadAhead, Direct, No Write Cache if Bad BBUDefault Access Policy: Read/WriteCurrent Access Policy: Read/WriteDisk Cache Policy   : Disk's DefaultEncryption Type     : NonePI type: No PIIs VD Cached: NoVirtual Drive: 2 (Target Id: 2)Name                :RAID Level          : Primary-0, Secondary-0, RAID Level Qualifier-0Size                : 278.875 GBSector Size         : 512Is VD emulated      : NoParity Size         : 0State               : OptimalStrip Size          : 256 KBNumber Of Drives    : 1Span Depth          : 1Default Cache Policy: WriteThrough, ReadAhead, Direct, No Write Cache if Bad BBUCurrent Cache Policy: WriteThrough, ReadAhead, Direct, No Write Cache if Bad BBUDefault Access Policy: Read/WriteCurrent Access Policy: Read/WriteDisk Cache Policy   : Disk's DefaultEncryption Type     : NonePI type: No PIIs VD Cached: NoVirtual Drive: 3 (Target Id: 3)Name                :RAID Level          : Primary-0, Secondary-0, RAID Level Qualifier-0Size                : 278.875 GBSector Size         : 512Is VD emulated      : NoParity Size         : 0State               : OptimalStrip Size          : 256 KBNumber Of Drives    : 1Span Depth          : 1Default Cache Policy: WriteThrough, ReadAhead, Direct, No Write Cache if Bad BBUCurrent Cache Policy: WriteThrough, ReadAhead, Direct, No Write Cache if Bad BBUDefault Access Policy: Read/WriteCurrent Access Policy: Read/WriteDisk Cache Policy   : Disk's DefaultEncryption Type     : NonePI type: No PIIs VD Cached: NoVirtual Drive: 4 (Target Id: 4)Name                :RAID Level          : Primary-0, Secondary-0, RAID Level Qualifier-0Size                : 837.843 GBSector Size         : 512Is VD emulated      : NoParity Size         : 0State               : OptimalStrip Size          : 256 KBNumber Of Drives    : 1Span Depth          : 1Default Cache Policy: WriteThrough, ReadAhead, Direct, No Write Cache if Bad BBUCurrent Cache Policy: WriteThrough, ReadAhead, Direct, No Write Cache if Bad BBUDefault Access Policy: Read/WriteCurrent Access Policy: Read/WriteDisk Cache Policy   : Disk's DefaultEncryption Type     : NonePI type: No PIIs VD Cached: NoVirtual Drive: 5 (Target Id: 5)Name                :RAID Level          : Primary-0, Secondary-0, RAID Level Qualifier-0Size                : 278.875 GBSector Size         : 512Is VD emulated      : NoParity Size         : 0State               : OptimalStrip Size          : 256 KBNumber Of Drives    : 1Span Depth          : 1Default Cache Policy: WriteBack, ReadAdaptive, Direct, No Write Cache if Bad BBUCurrent Cache Policy: WriteThrough, ReadAdaptive, Direct, No Write Cache if Bad BBUDefault Access Policy: Read/WriteCurrent Access Policy: Read/WriteDisk Cache Policy   : Disk's DefaultEncryption Type     : NonePI type: No PIIs VD Cached: NoVirtual Drive: 6 (Target Id: 6)Name                :RAID Level          : Primary-0, Secondary-0, RAID Level Qualifier-0Size                : 278.875 GBSector Size         : 512Is VD emulated      : NoParity Size         : 0State               : OptimalStrip Size          : 256 KBNumber Of Drives    : 1Span Depth          : 1Default Cache Policy: WriteBack, ReadAdaptive, Direct, No Write Cache if Bad BBUCurrent Cache Policy: WriteThrough, ReadAdaptive, Direct, No Write Cache if Bad BBUDefault Access Policy: Read/WriteCurrent Access Policy: Read/WriteDisk Cache Policy   : Disk's DefaultEncryption Type     : NonePI type: No PIIs VD Cached: NoVirtual Drive: 7 (Target Id: 7)Name                :RAID Level          : Primary-0, Secondary-0, RAID Level Qualifier-0Size                : 278.875 GBSector Size         : 512Is VD emulated      : NoParity Size         : 0State               : OptimalStrip Size          : 256 KBNumber Of Drives    : 1Span Depth          : 1Default Cache Policy: WriteBack, ReadAdaptive, Direct, No Write Cache if Bad BBUCurrent Cache Policy: WriteThrough, ReadAdaptive, Direct, No Write Cache if Bad BBUDefault Access Policy: Read/WriteCurrent Access Policy: Read/WriteDisk Cache Policy   : Disk's DefaultEncryption Type     : NonePI type: No PIIs VD Cached: NoExit 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: 0Enclosure id: 252Physical Drive ids: 3Raid 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 -aALL2、查看磁盘缓存策略 MegaCli -LDGetProp -Cache -L0 -a0or MegaCli -LDGetProp -Cache -L1 -a0or MegaCli -LDGetProp -Cache -LALL -a0or MegaCli -LDGetProp -Cache -LALL -aALLor MegaCli -LDGetProp -DskCache -LALL -aALL3、设置磁盘缓存策略 缓存策略解释: 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

转载于:https://www.cnblogs.com/xth0331/p/9655593.html

你可能感兴趣的文章
Nginx 防盗链
查看>>
如何讓Android系統顯示CJK擴展區漢字
查看>>
Android 下拉选择绑定Value和Text值
查看>>
HTML+CSS小结
查看>>
Android防止按钮连续点击
查看>>
ElasticSearch Mapping中的字段类型
查看>>
数据库中主键和外键的设计原则
查看>>
怎样理解阻塞非阻塞与同步异步的区别?
查看>>
Xcode 警告信息处理:Format string is not a string literal (potentially insecure)
查看>>
关于jQuery表单校验的应用
查看>>
matplotlib----初探------5直方图
查看>>
jquery之ajax
查看>>
Pro Git(中文版)
查看>>
解决phpmyadmin-1800秒超时链接失效问题
查看>>
OpenGL第十一节:拉伸和过滤
查看>>
AlertDialog的onCreateDialog与onPrepareDialog用法
查看>>
swift菜鸟入门视频教程-12-21讲
查看>>
PL/SQL 异常处理程序
查看>>
javascript小白学习指南1---0
查看>>
div:给div加滚动栏 div的滚动栏设置
查看>>