1. 程式人生 > >利用MegaCli工具,在線添加單硬盤做RAID0

利用MegaCli工具,在線添加單硬盤做RAID0

bst size dsta num list gic 外部 ada pset

1、MegaCLI工具的安裝
# rpm -ivh MegaCli-8.07.14-1.noarch.rpm
# rpm -ql MegaCli
/opt/MegaRAID/MegaCli/MegaCli
/opt/MegaRAID/MegaCli/MegaCli64
/opt/MegaRAID/MegaCli/libstorelibir-2.so.14.07-0

2、查看設備的相關信息

# cd /opt/MegaRAID/MegaCli/
# ./MegaCli64  -PDList -aALL
[root@cloudstack-01 MegaCli]# ./MegaCli64 -PDList -aALL

Adapter #0

Enclosure Device ID: 32
Slot Number: 0
Drive‘s position: DiskGroup: 0, Span: 0, Arm: 0
Enclosure position: 1
Device Id: 0
WWN: 5000C50095C32BD4
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: 558.375 GB [0x45cc0000 Sectors]
Sector Size:  512
Logical Sector Size:  512
Physical Sector Size:  512
Firmware state: Online, Spun Up
Device Firmware Level: ES66
Shield Counter: 0
Successful diagnostics completion on :  N/A
SAS Address(0): 0x5000c50095c32bd5
SAS Address(1): 0x0
Connected Port Number: 2(path0) 
Inquiry Data: SEAGATE ST3600057SS     ES666SLAPH5J            
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 Temperature :44C (111.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

Enclosure Device ID: 32
Slot Number: 1
Drive‘s position: DiskGroup: 0, Span: 0, Arm: 1
Enclosure position: 1
Device Id: 1
WWN: 5000C50095BC809C
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: 558.375 GB [0x45cc0000 Sectors]
Sector Size:  512
Logical Sector Size:  512
Physical Sector Size:  512
Firmware state: Online, Spun Up
Device Firmware Level: ES66
Shield Counter: 0
Successful diagnostics completion on :  N/A
SAS Address(0): 0x5000c50095bc809d
SAS Address(1): 0x0
Connected Port Number: 0(path0) 
Inquiry Data: SEAGATE ST3600057SS     ES666SLARKD5            
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 Temperature :45C (113.00 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: 32
Slot Number: 2
Drive‘s position: DiskGroup: 3, Span: 0, Arm: 0
Enclosure position: 1
Device Id: 2
WWN: 5000C50095B4537C
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: 558.375 GB [0x45cc0000 Sectors]
Sector Size:  512
Logical Sector Size:  512
Physical Sector Size:  512
Firmware state: Online, Spun Up
Device Firmware Level: ES66
Shield Counter: 0
Successful diagnostics completion on :  N/A
SAS Address(0): 0x5000c50095b4537d
SAS Address(1): 0x0
Connected Port Number: 4(path0) 
Inquiry Data: SEAGATE ST3600057SS     ES666SLARAG7            
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 Temperature :45C (113.00 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: 32 (附件設備ID)
Slot Number: 3  (插槽號)
Drive‘s position: DiskGroup: 2, Span: 0, Arm: 0
Enclosure position: 1
Device Id: 3
WWN: 5000C500958CE818   (磁盤的WWN號)
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: 558.375 GB [0x45cc0000 Sectors]
Sector Size:  512
Logical Sector Size:  512
Physical Sector Size:  512
Firmware state: Online, Spun Up
Device Firmware Level: ES66
Shield Counter: 0
Successful diagnostics completion on :  N/A
SAS Address(0): 0x5000c500958ce819
SAS Address(1): 0x0
Connected Port Number: 1(path0) 
Inquiry Data: SEAGATE ST3600057SS     ES666SLAQ3FV            
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 Temperature :45C (113.00 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: 32
Slot Number: 4
Drive‘s position: DiskGroup: 1, Span: 0, Arm: 0
Enclosure position: 1
Device Id: 4
WWN: 5000C5008FA725C4
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: 558.375 GB [0x45cc0000 Sectors]
Sector Size:  512
Logical Sector Size:  512
Physical Sector Size:  512
Firmware state: Online, Spun Up
Device Firmware Level: ES66
Shield Counter: 0
Successful diagnostics completion on :  N/A
SAS Address(0): 0x5000c5008fa725c5
SAS Address(1): 0x0
Connected Port Number: 3(path0) 
Inquiry Data: SEAGATE ST3600057SS     ES666SLAP6YY            
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 Temperature :37C (98.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

Exit Code: 0x00

3、添加新的磁盤

# ./MegaCli64 -CfgLdAdd -r0[32:5] WB Direct -a0
說明:
r0: raid0
[32:5]:32為Enclosure Device ID,5為Slot Number
WB Direct:磁盤Write back

4、添加一塊帶有殘余信息的磁盤

# ./MegaCli64 -cfgforeign -scan -a0
There are 1 foreign configuration(s) on controller 0.

Exit Code: 0x00
說明:由於是新插入的盤,而且是塊有數據的盤,所有提示有外部配置。
# ./MegaCli64 -cfgforeign -clear -a0
Foreign configuration 0 is cleared on controller 0.

Exit Code: 0x00
# ./MegaCli64 -cfgforeign -scan -a0
There is no foreign configuration on controller 0.

Exit Code: 0x00
說明:清除外部配置信息,清除後再次進行查看
# ./MegaCli64 -CfgLdAdd -r0[32:5] WB Direct -a0
Adapter 0: Created VD 1

Adapter 0: Configured the Adapter!!

Exit Code: 0x00

5、查看Firmware state

# ./MegaCli64 -PDList -aALL -Nolog|grep ‘^Firm‘
Firmware state: Online, Spun Up
Firmware state: Online, Spun Up
Firmware state: Online, Spun Up
Firmware state: Online, Spun Up
Firmware state: Online, Spun Up
這裏的Firmware state有可能會有類似於“Firmware state: JBOD”狀態的

6、關閉JBOD模式

# /opt/MegaRAID/MegaCli/MegaCli64 -AdpSetProp -EnableJBOD -0 -aALL

Adapter 0: Set JBOD to Disable success.

Exit Code: 0x00

7、檢查陣列的配置

# /opt/MegaRAID/MegaCli/MegaCli64 -LDInfo -LALL -aAll | grep RAID
RAID Level          : Primary-1, Secondary-0, RAID Level Qualifier-0
RAID Level          : Primary-0, Secondary-0, RAID Level Qualifier-0
RAID Level          : Primary-0, Secondary-0, RAID Level Qualifier-0
RAID Level          : Primary-0, Secondary-0, RAID Level Qualifier-0

利用MegaCli工具,在線添加單硬盤做RAID0