megarc で MegaRAID をいぢる。

Intel SRCZCRX (FreeBSD では MegaRAID で認識)なカードで使える管理ツール…というか、MegaRAID の管理ツールです。以下 dmesg より抜粋

amr0:  mem 0xf0000000-0xf7ffffff,0xfce80000-0xfcefffff irq 24 at device 3.0 on pci2
amr0:  Firmware 413Y, BIOS H420, 128MB RAM

キタコレ。ports の sysutil/megarc に入ってます。
これでコマンドラインから RAID 情報を見たり Rebuild 状況が見れるはずですよ。

MegaRAID は DELL のマシンでもポツポツ使われているようですね。「Dell CERC」 というのが MegaRAID のようです。

使えるコマンドは下記の通り、大変多くてドレがどれやら…。

とりあえずリブートせずに警告音を消せるようになったのが良いですね。今までだと一旦リブートして RAID 設定画面に突入する必要がありました。しかもマウス必須(笑)。

後は megascan を走らせておけば Mail で通知もしてくれていい感じです。

コマンド名 内容
-AllAdpInfo : prints info of all cards
-ldInfo : Shows specified logical drives info
-abortCCBI : Aborts CC & BI operation on all log drives(if any) of adapter
-abortInit : Aborts Initialization operation on given logical drive(s)
-ViewExtSenseData : Shows Extended Sense Data for given phys drive
-enableBI, -disableBI : Enable/Disable Background Initialization on adapter X
-enMULTIPLIER, -disMULTIPLIER : Enable/Disable Port MULTIPLIER on SATA-8X adapter
-enableNCQ, -disableNCQ : Enable/Disable NCQ on SATA-8X adapter
-enSMART, -disSMART : Enable/Disable SMART mode on adapter X
-ViewInitProg : Displays Init Progress on all eligible log drives of adapter
-ViewBICCProg : Displays BI/CC Progress on all eligible log drives of adapter
-disPR, -enPRauto, -enPRman : Enable/Disable PR on adp X Refer to Patrol Read docs at LSI for more info
-startPR, -stopPR : Start/Stop PR on adp X
-getPRinfoy : Get PR info on adp X
-setPRdelay : Set PR delay on adp X
-getNVRAMLog : Get NVRAM Event Entry on adp X
-clrNVRAMLog : Clear NVRAM Log on adp X
-EnTmpOfflineRAID, -DisTmpOfflineRAID : Enable/Disable Temp Offline RAID on adp X
-EnCCRecovery, -DisCCRecovery : Enable/Disable CC Recovery on adp X
-enAlarm, -disAlarm, -silenceAlarm, -showAlarm : Enables/Disable/Silence/Shows current alarm on adapter
-showRbld : Displays rebuild progress of all drives in rebuild state
-stopRbld : Stops rebuild process of the specified drives
-doRbld : Runs rebuild option on the specified drives : Displays the progress if -ShowProg is specified
-autoRbldOn,-autoRbldOff  
-physSetHsp : make the specified hotspare drive as ready
-physUnsetHsp : make the specified drive hotspare
-GetRbldrate, -SetRbldrate : Displays current RebuildRate of adapter
-ctlrInfo :Shows general adapter info of adapter
-clrCfg : Clears config of adapter
-addCfg  
-newCfg  
-physOn, -physOff : Change the physical state
-phys, -physdrvSerialInfo : Displays physical drive information
-facDef : Sets factory default params on adapter
-chkonLd, -initLd, -cldCfg  
-spannewcfg, -spanaddcfg  
-showBios, -disBios, -enableBios  
-DfcfgAndParm  
-ScfgAndParm,-RcfgAndParm  
-pSetCache  
-pdFailInfo, -clrErrHistory  
-EachDskRaid0 : Configures Each Disk as RAID-0 LogicalDrive
-LogPhysInfo  
-DelLd,-FreeSpaceInfo  
-offBIOS_Echo,-onBIOS_Echo,-offBIOS_SOE,-onBIOS_SOE  
-dskBIOScfgm,-nvBIOScfgm,-usrBIOScfgm  
-FastInitOn, -FastInitOff  
-SetFrpON, -SetFrpOFF  
-EmulI2O, -EmulMass  
-dskSpinUP, -setFlush  
-ForceBootON, -ForceBootOFF  
-enPciDelay, -disPciDelay, -vuPciDelay  
-CoercionON, -CoercionOFF, -CoercionVu  
-ShowdskSpinUP  
-saveCfg, -restoreCfg  
-dispFileCfg, -dispCfg or ?  
-setXFerRate, -getXFerRate  
各コマンドのHELPを見る。
# megarc [cmd] ?

csh の場合は?の前にバックスラッシュ必要です。

例: ldInfo コマンドの HELP を見る
# megarc -ldInfo \?

        *********************************************************************
              MEGARC MegaRAID Configuration Utility(FreeBSD)-1.04(03-02-2005)     
              By LSI Logic Corp.,USA
        **********************************************************************
          [Note: For SATA-2, 4 and 6 channel controllers, please specify
          Ch=0 Id=0..15 for specifying physical drive(Ch=channel, Id=Target)]

        Type ? as command line arg for help

        **********************************************************************

         usage :
         cmd -ldInfo -aX -Lx1[-Lx2..[_Lxn]]|-Lall
         : Shows specified logical drives info
        **********************************************************************
         where :
           cmd : name of the utility
           -aX : adapter number X(max 12 adapters). X=0..11
           -Lxn : number of logical drive
                  n = 0...7 for 8Ld and 0...39 for 40Ld firmware
          -Lall : all logical drives present on card
                  It overrides the Lxn option,if both are given
        **********************************************************************
カード情報を見る

# megarc -AllAdpInfo

        **********************************************************************
              MEGARC MegaRAID Configuration Utility(FreeBSD)-1.04(03-02-2005)     
              By LSI Logic Corp.,USA
        **********************************************************************
          [Note: For SATA-2, 4 and 6 channel controllers, please specify
          Ch=0 Id=0..15 for specifying physical drive(Ch=channel, Id=Target)]

        Type ? as command line arg for help

        AdapterNo  FirmwareType  CardType
        00          40LD/8SPAN    Intel(R) RAID Controller SRCZCRX

物理ドライブ状態を見る

megarc -phys -a0 -ch0 -idAll

        Finding Devices On Each MegaRAID Adapter...


        Adapter 0, Channel 0, Target ID 0       ----------------------------------------
        Type: DISK                 Vendor      : SEAGATE 
        Product: ST336607LC        Revision    : 0006
        Synchronous   : Yes        Wide-32     : No    Wide-16: Yes
        LinkCmdSupport: Yes        TagQ support: Yes   RelAddr: No 
        Removable     : No         SoftReset   : No    AENC   : No 


        Adapter 0, Channel 0, Target ID 1       ----------------------------------------
        Type: DISK                 Vendor      : SEAGATE 
        Product: ST336607LC        Revision    : 0007
        Synchronous   : Yes        Wide-32     : No    Wide-16: Yes
        LinkCmdSupport: Yes        TagQ support: Yes   RelAddr: No 
        Removable     : No         SoftReset   : No    AENC   : No 

論理ドライブ状態を見る

# megarc -ldInfo -a0 -L0

        **********************************************************************
              MEGARC MegaRAID Configuration Utility(FreeBSD)-1.04(03-02-2005)     
              By LSI Logic Corp.,USA
        **********************************************************************
          [Note: For SATA-2, 4 and 6 channel controllers, please specify
          Ch=0 Id=0..15 for specifying physical drive(Ch=channel, Id=Target)]

        Type ? as command line arg for help


        Finding Devices On Each MegaRAID Adapter...
        Scanning Ha 0, Chnl 1 Target 15  

                *******Information Of Logical Drive 0*******

          Logical Drive : 0( Adapter: 0 ):  Status: OPTIMAL
        ---------------------------------------------------
        SpanDepth :01     RaidLevel: 1  RdAhead : Yes  Cache: DirectIo
        StripSz   :064KB   Stripes  : 2  WrPolicy: WriteThru

        Logical Drive 0 : SpanLevel_0 Disks
        Chnl  Target  StartBlock   Blocks      Physical Target Status
        ----  ------  ----------   ------      ----------------------
        0      00    0x00000000   0x0430e000   ONLINE
        0      01    0x00000000   0x0430e000   ONLINE
物理ドライブをオフラインにする。

ch0:ta1 のドライブをオフラインに設定する。
# megarc -physOff -a0 pd[0:1]

        Finding Devices On Each MegaRAID Adapter...
        Scanning Ha 0, Chnl 1 Target 15  

        changed state of physical drive 1 on channel 0 to offline

当然 RAID1 の状態がヤバイ事になるわけでアラーム発生。この時の論理ドライブの状態を見てみると
# megarc -ldInfo -a0 -L0

        Finding Devices On Each MegaRAID Adapter...
        Scanning Ha 0, Chnl 1 Target 15  

                *******Information Of Logical Drive 0*******

          Logical Drive : 0( Adapter: 0 ):  Status: DEGRADED
        ---------------------------------------------------
        SpanDepth :01     RaidLevel: 1  RdAhead : Yes  Cache: DirectIo
        StripSz   :064KB   Stripes  : 2  WrPolicy: WriteThru

        Logical Drive 0 : SpanLevel_0 Disks
        Chnl  Target  StartBlock   Blocks      Physical Target Status
        ----  ------  ----------   ------      ----------------------
        0      00    0x00000000   0x0430e000   ONLINE
        0      01    0x00000000   0x0430e000   FAILED
アラームを止める

先ずはウルサイアラームを止めます。ホントうるさいです。とは言え、うるさくないとデータセンタなんかに置いてる時に気がつきにくい訳ですが。
# megarc -SilenceAlarm -a0

        Silenced Alarm on Adapter 0
リビルド

オートリビルド設定にしてあれば、ディスクを入れ替えるだけでリビルドが始まります。

# megarc -ldInfo -a0 -L0

        Finding Devices On Each MegaRAID Adapter...
        Scanning Ha 0, Chnl 1 Target 15  

                *******Information Of Logical Drive 0*******

          Logical Drive : 0( Adapter: 0 ):  Status: DEGRADED
        ---------------------------------------------------
        SpanDepth :01     RaidLevel: 1  RdAhead : Yes  Cache: DirectIo
        StripSz   :064KB   Stripes  : 2  WrPolicy: WriteThru

        Logical Drive 0 : SpanLevel_0 Disks
        Chnl  Target  StartBlock   Blocks      Physical Target Status
        ----  ------  ----------   ------      ----------------------
        0      00    0x00000000   0x0430e000   ONLINE
        0      01    0x00000000   0x0430e000   RBLD
リビルド状況確認

# megarc -showRbld -a0

***********************************************************************
                Monitoring rebuild progress on Adapter-0

    Here:
        C-Channel Number
        id-Target Number
        %age-Percentage Completion


***********************************************************************
C id %age 
0 01 002