背景:某臺機器作個幾塊單盤RAID0,能夠理解成單盤單用,由於有RAID卡必需要作RAID才能識別到硬盤,因此單塊盤也要作成RAID0。如今有塊盤壞了,廠家換了新盤沒重作,怎麼恢復呢?緩存
一、查看全部磁盤的狀態,這沒啥好說的ui
./MegaCli64 -PDList -a0
二、有塊盤Firmware state是Unconfigured(bad),這是今天要拯救的目標code
Enclosure Device ID: 0 Slot Number: 3 Device Id: 8 Sequence Number: 2 Media Error Count: 0 Other Error Count: 0 Predictive Failure Count: 0 Last Predictive Failure Event Seq Number: 0 PD Type: SATA Raw Size: 3.638 TB [0x1d1c0beb0 Sectors] Non Coerced Size: 3.637 TB [0x1d1b0beb0 Sectors] Coerced Size: 3.637 TB [0x1d1b00000 Sectors] Firmware state: Unconfigured(bad) SAS Address(0): 0x5001c45000785ca3 Connected Port Number: 0(path0) Inquiry Data: 手動馬賽克 FDE Capable: Not Capable FDE Enable: Disable Secured: Unsecured Locked: Unlocked Foreign State: None Device Speed: Unknown Link Speed: Unknown Media Type: Hard Disk Device
三、可選:查看磁盤的緩存策略,每塊盤一行,如今的結果應該少一行,由於少塊盤it
./MegaCli64 -LDGetProp -Cache -Lall -a0
四、先讓這塊磁盤變成goodio
./MegaCli64 -PDMakeGood -PhysDrv[0:3] -a0 Adapter: 0: EnclId-0 SlotId-3 state changed to Unconfigured-Good. Exit Code: 0x00
這裏-PhysDrv[0:3]對應上面的Enclosure Device ID和Slot Number,-a確定是Adapter #0,不太懂爲啥盤要有Good/bad之分。再看磁盤的狀態ast
Enclosure Device ID: 0 Slot Number: 3 Device Id: 8 Sequence Number: 3 Media Error Count: 0 Other Error Count: 0 Predictive Failure Count: 0 Last Predictive Failure Event Seq Number: 0 PD Type: SATA Raw Size: 3.638 TB [0x1d1c0beb0 Sectors] Non Coerced Size: 3.637 TB [0x1d1b0beb0 Sectors] Coerced Size: 3.637 TB [0x1d1b00000 Sectors] Firmware state: Unconfigured(good), Spun Up SAS Address(0): 0x5001c45000785ca3 Connected Port Number: 0(path0) Inquiry Data: 手動馬賽克 FDE Capable: Not Capable FDE Enable: Disable Secured: Unsecured Locked: Unlocked Foreign State: Foreign Foreign Secure: Drive is not secured by a foreign lock key Device Speed: Unknown Link Speed: Unknown Media Type: Hard Disk Device
五、磁盤確實Good了,可是Foreign State變成了Foreign,須要清除ForeignList
./MegaCli64 -cfgforeign -clear -a0 Foreign configuration 0 is cleared on controller 0. Exit Code: 0x00
再看磁盤的狀態closure
Enclosure Device ID: 0 Slot Number: 3 Device Id: 8 Sequence Number: 3 Media Error Count: 0 Other Error Count: 0 Predictive Failure Count: 0 Last Predictive Failure Event Seq Number: 0 PD Type: SATA Raw Size: 3.638 TB [0x1d1c0beb0 Sectors] Non Coerced Size: 3.637 TB [0x1d1b0beb0 Sectors] Coerced Size: 3.637 TB [0x1d1b00000 Sectors] Firmware state: Unconfigured(good), Spun Up SAS Address(0): 0x5001c45000785ca3 Connected Port Number: 0(path0) Inquiry Data: 手動馬賽克 FDE Capable: Not Capable FDE Enable: Disable Secured: Unsecured Locked: Unlocked Foreign State: None Device Speed: Unknown Link Speed: Unknown Media Type: Hard Disk Device
六、如今再作RAID0dict
./MegaCli64 -cfgldadd -r0 [0:3] WB RA Direct -a0 Adapter 0: Created VD 馬賽克 Adapter 0: Configured the Adapter!! Exit Code: 0x00
這時候再看./MegaCli64 -LDGetProp -Cache -Lall -a0,應該會多一行,對應上面的新VDdi