lsiutil to add hot spare drive on line for mpt raid controllers

environment: HP ProLiant ML150 G5 with Ubuntu 8.04 installed

  • Run “mpt-status –i 1” to get the current array information.

    ioc0 vol_id 1 type IM, 2 phy, 231 GB, state DEGRADED, flags ENABLED
    ioc0 phy 0 scsi_id 2 ATA      GB0250C8045      HPG2, 232 GB, state ONLINE, flags NONE
    ioc0 phy 1 scsi_id 9 ATA      GB0250EAFJF      HPG1, 232 GB, state FAILED, flags OUT_OF_SYNC
  • Run “cat /proc/scsi/scsi” to get the available drives information
  • Run “lsiutil”
    • Select the correct port, you can find the information from the 1st step
    • Select 8, and then 16 to confirm the physical drive information, recommended
    • Then select 21 to enter “RAID actions”
    • Select 50 “Create hot spare”
    • You need to figure out the 2 parameters yourselves, I forgot to write down
    • 1st is something like the drive number, you have to compare the information I asked you to collect
    • 2nd is something like the spare group, I suggest you use the same number you use for “mpt-status –i”
    • Then if you select 2 “show physical disks” you will see your hot spare drive
    • Last we run 99 “reset port” to activate the hot spare.
    • Select 0 until you back to shell
  • Run “mpt-status –i 1” again to confirm it is now recovering
    ioc0 vol_id 1 type IM, 2 phy, 231 GB, state DEGRADED, flags ENABLED RESYNC_IN_PROGRESS
    ioc0 phy 2 scsi_id 2 ATA      GB0250C8045      HPG2, 232 GB, state ONLINE, flags NONE
    ioc0 phy 0 scsi_id 3 ATA      GB0250EAFYK      HPG1, 232 GB, state ONLINE, flags OUT_OF_SYNC

MegaCli命令速查[转]

转自http://hi.baidu.com/ytjwt/blog/item/6d2dfd108c85db70cb80c4e1.html

最近,老是磁盘error,而自己确没有迅速的定位,实在是感到杯具,看到同事们MegaCli查看raid及磁盘错误信息,我这里粘贴下网上别人用的命令,方便自己查阅(另dmesg:显示开机信息,dmidecode,硬件信息)

MegaCli用起来还是很简单的。摘抄一些比较常用的参数如下:

显示适配器个数: MegaCli -adpCount
显示适配器时间: MegaCli -AdpGetTime –aALL
显示所有适配器信息: MegaCli -AdpAllInfo -aAll
显示所有逻辑磁盘组信息: MegaCli -LDInfo -LALL -aAll
显示所有的物理信息: MegaCli -PDList -aAll
查看充电状态: 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
显示Raid卡型号,Raid设置,Disk相关信息: MegaCli -cfgdsply -aALL
查看Cache 策略设置: MegaCli -cfgdsply -aALL |grep Policy
查看充电进度百分比: MegaCli -AdpBbuCmd -GetBbuStatus -aALL |grep ‘Relative State of Charge’

当挂载一磁盘到raid卡上时,是通过fdisk -l查看不了的。我们需要对其做raid,

在线创建raid:

MegaCli -CfgLdAdd -r0 [1:10] WB Direct -a0
MegaCli -CfgLdAdd -r0 [1:11] WB Direct -a0
echo "scsi add-single-device 0 2 1 0" >/proc/scsi/scsi
echo "scsi add-single-device 0 2 2 0" >/proc/scsi/scsi

这样在fdisk -l 就能看到了

RAID 5时,当磁盘坏了,备盘变为online后,如果坏的磁盘已经修好,那么我们需要把修好的盘变为备盘,命令如下:

MegaCli -PDHSP -Set [-EnclAffinity] [-nonRevertible] -PhysDrv[1:5] -a0
# MegaCli -PDHSP -set -PhysDrv[A:B] -aC
A:  it’s Enclosure Number
B: It’s Slot NUmber
C: It’s Array ID2

各种设备和磁盘的不同状态:

Device         |Normal|Damage|Rebuild|Normal
Virtual Drive     |Optimal|Degraded|Degraded|Optimal
Physical Drive     |Online|Failed –> Unconfigured|Rebuild|Online

完整的操作手册在这里:http://www.lsi.com/DistributionSystem/AssetDocument/80-00156-01_RevF.pdf

PS:
关于缓存与电池的操作

强制打开写入缓存(慎用

MegaCli -LDSetProp CachedBadBBU -LALL -aALL
MegaCli -LDSetProp ForcedWB -LALL -aALL

设定没有电池就不缓存:

MegaCli -LDSetProp WB -LALL -aALL
MegaCli -LDSetProp NoCachedBadBBU -LALL -aALL