From FreeBSDwiki
Jump to: navigation, search

Megarc is a commandline utility that provides an interface to many of the configuration and reporting functions for LSI Logic's MegaRAID BIOS (


Megarc port for FreeBSD

The megarc utility ships as a binary, without any accompanying documentation, on the "Megaraid Universal Software Suite" CD which accompanies any boxed LSI Logic RAID storage adapter. It is also found in the FreeBSD ports collection.

  • On the CD that comes with the storage adapter, the utility is found in two places. It is part of a zipped bundle in <cd>:\SW_Components\Drivers\ on our distribution. The zip file contents are as follows:
  Length     Date   Time    Name
 --------    ----   ----    ----
   130448  04-18-05 14:10   MegaRC
    12953  10-08-04 16:05   amr_x86_64_ver1_51FreeBSD5.3.tgz
   153600  03-17-05 15:19   code.tar
      535  02-10-05 11:02   FreeBSDDriverUpdate.txt
    12774  10-12-04 19:38   amr_i386_ver_1_51_FreeBSD5.3.tgz
 --------                   -------
   310310                   5 files
  • The utility is also found on the CD by itself, at "<cd>:\SW_Components\Utilities\ut_FreeBSD_MegaRC".
  • It can be also be installed from the ports collection at /usr/ports/sysutils/megarc. The port extracts the binary from the bundled dr_freebsd_*.zip Our example was installed from the ports collection on 6.1-PRERELEASE FreeBSD amd64

# file /usr/local/sbin/megarc
 /usr/local/sbin/megarc: ELF 32-bit LSB executable, Intel 80386,
 version 1 (FreeBSD), for FreeBSD 5.2.1, statically linked, stripped


The documentation for megarc is limited to the output of its ?/help functions. Since these RAID adapters are reasonably popular, and the commands are a bit scary and somewhat obscurely named, this page might prove helpful to someone even though it's not complete.

Megarc must be run with sufficient privileges, or the adapter will not be found. "?" and "help" are not synonymous. ? (mis-named "complete help") gives brief syntax hints. help gives a fuller description of what the command does, and its arguments and usage.

  • To see the commands available, as root type:
    megarc ?
   First Parameter should be :
      ... etc ...
  • To see a list of commands and syntax, type:
    megarc help
        * Convention Used:
           [Cmd = The name of the utility]
           opt1|opt2|opt3 => Only one of these can be specified

 Cmd ?: Gives complete help
 Cmd -functionality ?: functionality specific help
 Cmd -ctlrInfo ? :help on -ctlrinfo option

 Usage: Cmd -ctlrInfo  -aX 
 ... etc ...
  • Example:
    megarc -ctlrInfo help

  usage :
  cmd -ctlrInfo -aX
  : Shows general adapter info of adapter
  where :
    cmd : name of the utility
    -aX : adapter number X(max 12 adapters). X=0..11


For the examples below, we are using an LSILogic 150-6 x64 SATA RAID adapter on a 32-bit PCI slot - "adapter 0" on the system - with a RAID 5 volume consisting of five (5) physical SATA drives of 400GB each. The hot-spare belongs to target 00 but is being replaced at the time of this writing.

Below are some brief descriptions of some of the commands, and some examples of output from a few of the information functions. These command-options are not case-sensitive.

megarc -dispCfg -a0

Display the configuration for adapter 0.

          Logical Drive : 0( Adapter: 0 ):  Status: OPTIMAL
        SpanDepth :01     RaidLevel: 5  RdAhead : No  Cache: DirectIo
        StripSz   :064KB   Stripes  : 5  WrPolicy: WriteThru

        Logical Drive 0 : SpanLevel_0 Disks
        Chnl  Target  StartBlock   Blocks      Physical Target Status
        ----  ------  ----------   ------      ----------------------
        0      01    0x00000000   0x2e936800   ONLINE
        0      02    0x00000000   0x2e936800   ONLINE
        0      03    0x00000000   0x2e936800   ONLINE
        0      04    0x00000000   0x2e936800   ONLINE
        0      05    0x00000000   0x2e936800   ONLINE

megarc -LogPhysInfo -a0

Display the physical drive information for each of the logical drives on adapter 0.

        Logical drive 0: RaidLevel 5

        Physical Drive Information
        Channel 0
                381549MB drive ID 1
        CoerSZ: 781412352(Sectors) 381549(MB)  RawSZ: 781422255(Sectors)
                381549MB drive ID 2
        CoerSZ: 781412352(Sectors) 381549(MB)  RawSZ: 781422255(Sectors)
                381549MB drive ID 3
        CoerSZ: 781412352(Sectors) 381549(MB)  RawSZ: 781422255(Sectors)
                381549MB drive ID 4
        CoerSZ: 781412352(Sectors) 381549(MB)  RawSZ: 781422255(Sectors)
                381549MB drive ID 5
        CoerSZ: 781412352(Sectors) 381549(MB)  RawSZ: 781422255(Sectors)

megarc -ScfgAndParm|-DfcfgAndParm|-RcfgAndParm -fFileName -a0

Save, Display, or Restore the configuration and parameters for adapter 0, in FileName. FileName stores the same output provided by -dispCfg in a binary format, making it possible to directly load the stored configuration from the file.

megarc -physOn pd[c0:t0,c1:t1....] -a0

Set the state of the designated drive(s) to Online. pd[c:t] refers to at least one physical drive by channel and target. -aN here as elsewere is the adapter number [required]

If the physical drive does not exist or if it isn't in failed state, the utility exits with no harm done.

An example of this command under our present configuration would be:

megarc -physOn -a0 pd[0:1]

megarc -phys -chAll -idAll -a0

Show the physical drive description for each device on all channels managed by adapter 0

        Adapter 0, Channel 0, Target ID 1     
        Type: DISK                 Vendor      : WDC
        Product: WD4000KD-00NAB0   Revision    : 01.0
        Synchronous   : No         Wide-32     : No    Wide-16: No
        LinkCmdSupport: No         TagQ support: No    RelAddr: No
        Removable     : No         SoftReset   : No    AENC   : No

megarc -physdrvSerialInfo -chAll -idAll -a0

Show the serial number for each physical drive on each channel for all serial devices managed by adapter 0 (This doesn't look correct or helpful).

  Adapter 0, Channel 0, Target ID 1 

  PhysDrvSerial#:      WD-W

 etc ...

megarc -pdFailInfo -chAll -idAll -a0

Show the failure history for each device on all channels managed by adapter 0.

megarc -setRbldRate|-getRbldRate -a0

Get the rebuild rate for adapter 0.

# megarc -getRbldRate -a0


 RebuildRate of Adapter-0 is 30

megarc -ctlrInfo -a0

Display information about adapter 0.

  Information of Adapter-0 (#Adapter(s) on system: 1)

  Firmware Version : 713N         BIOS Version : G119
  Logical Drives : 01             DRAM : 64MB
  Rebuild Rate : 30%
  Flush Interval : 4 secs
  Number Of Chnls : 1             Bios Status : Enabled
  Alarm State : Enabled           Auto Rebuild : Enabled
  FW : SPAN-8, 40-LD              BIOS Config AutoSelection : USER
  BIOS Echos Mesg : ON            BIOS Stops On Error : ON
  Initiator Id : 16(Clustered Firmware)
  Board SN: -17179869

megarc -getXFerRate|-setXFerRate -a0 -chAll

Get or set the transfer rate for all channels on adapter 0.

# megarc -getXFerRate -a0 -ch0

   Transfer Rate of Adapter-0 Channel-0 is 160M
Personal tools