Recent Posts

exclude .git and .svn from apache
posted on 2016-09-27 11:32

To prohibit the source control folders from being served by the webserver, use this in you apache vhost config:

<DirectoryMatch \.svn>
    Order allow,deny
    Deny from all
</DirectoryMatch>

<DirectoryMatch \.git>
    Order allow,deny
    Deny from all
</DirectoryMatch>
oneliner for debian-sys-maint mysql user
posted on 2016-09-23 16:08
mysql -u debian-sys-maint -h localhost -p $(grep password /etc/mysql/debian.cnf | head -1 | awk '{print $3}') mysql
adaptec raid initializing modes
posted on 2016-09-23 00:18

An explanation from the official source here.

Build / Verify

Array is available for use immediately.

The Build operation continues in the background.

Therefore, an operating system installation may begin while the array is going through the Build process, although performance will be impacted until the process has completed.

Creates parity/redundancy for each disk in the array.

Example: For a RAID 1 logical drive, data is copied from the source drive to the mirrored drive.

For RAID 5 and RAID 6, parity is computed and written.

A Build can take up to 20x longer than Clear (due to parity generation).

Clear

Array is not available to use until the operation completes.

Fastest way to set the disks into a known good state.

Writes only zeroes to the disk.

Although no real redundancy/parity is created, all disk sectors contain zeroes (no data) so none is required.

Any future write operations will create required redundancy.

Quick Init

Array is available for use immediately.

Only creates metadata on member disks of the array, the build process is bypassed, the first few and last blocks in the user addressable area (incl. partition tables) will be wiped off.

While this is the fastest method for creating a RAID array, it is only recommended for use with new drives.

Performance will be impacted while the logical drive is in Quick Init mode until a Verify with Fix is performed from the Adaptec / ICP Storage Manager software.

For striped arrays (such as RAID 0, RAID 10, RAID 50, RAID 60), write performance is affected when less than a full stripe is written.

The array remains in full-stripe write mode until a Verify with fix operation is completed to validate redundant information.

Default Setting for RAID 1, RAID 1EE, and RAID 10 arrays.

Skip Init

Updates metadata only.

If multiple disk drives fail in the same logical device, it may be possible to recover the data by recreating the logical device without the initialization step (skip init).

Omitting the initialization step reconstructs the logical device metadata without modifying or destroying other data on the disks.

ultimate LSI megacli help
posted on 2016-09-23 00:01

I was fed up and did some shell scripting with serious sed'ing.

The result was this:

MC=/root/MegaCli; while read i; do echo; echo '============================================================================='; echo $'\e[31;1m'$i$'\e[0m'; $MC help $(echo $i | sed 's/XD //'); done < <($MC help | grep -e '^MegaCli' | sed 's/\(^MegaCli\s\(-\w\+\|\w\+\s-\w\+\)\)\s.*/\1/g' | awk '$1=" "' | sed 's/-//' | sed 's/\(.*\)/\U\1/' | sort | uniq | cut -c3-) | grep -v -e "MegaCLI SAS RAID Management Tool" -e Copyright | cat -s | sed 's/\(Syntax: \)\(.*\)/\1\L\2/' | sed -e '/Syntax/  s/-//g' -e '/Syntax/ s/\[e/"&/' -e '/Syntax/ s/\.\]/&"/' -e '/Syntax/ s/\(physdrv\)\(\S\)/\1 \2/' | sed 's/arraya,/array A/; s/rowb/rob B/' | grep -v -e '^Exit Code' | sed '/^\s*$/d' | sed '/^Syntax: / s//\n&\n\t/; /^Description:/ s//\n&/; /^Convention:/ s//\n&/' | less -R

This looks like shit, has some bugs and and very likely can use a lot of clean up.

But it gave me this, which should be the best help about the MegaCli out there. Ever. And no, you really don't need hypens or CaseSensitive commands.

=============================================================================
ADPALILOG
            AdpAlILog   
            ---------

Syntax: 
    megacli adpalilog an|a0,1,2|aall

Description: 
        Command retrieve all RAID subsystem log for troubleshooting use. Combines all the INFO commands (adp, vd, pd, encl, bbu) and adds OS information, Memory size, driver version and so on..

Convention:   
          -aN         N specifies the adapter number for the command.
          -a0,1,2     Specifies the command is for adapters 0, 1, and 2. More than one adapter can be selected.
          -aALL       Specifies the command is for all adapters.
=============================================================================
ADPALLINFO
            AdpAllInfo
            ----------

Syntax: 
    megacli adpallinfo an|a0,1,2|aall

Description: 
        Display parameters on the given adapter(s).
        Displays information of adapter, including cluster state, BIOS, alarm, 
        firmware version, BIOS version, battery charge counter value, rebuild 
        rate, bus number/device number, present RAM, serial number of the board, 
        and SAS address.

Convention:   
          -aN         N specifies the adapter number for the command.
          -a0,1,2     Specifies the command is for adapters 0, 1, and 2. You can 
                      select two or more adapters in this manner.
          -aALL      Specifies the command is for all adapters. 
=============================================================================
ADPAUTORBLD
            AdpAutoRbld
            -----------

Syntax: 
    megacli adpautorbld enbl|dsbl|dsply an|a0,1,2|aall

Description: 
        Enables or disables automatic rebuild on the selected adapter(s).
        The -Dsply option shows the status of the automatic rebuild state.

Convention:   
          -aN         N specifies the adapter number for the command.
          -a0,1,2     Specifies the command is for adapters 0, 1, and 2. You can 
                      select two or more adapters in this manner.
          -aALL       Specifies the command is for all adapters.
=============================================================================
ADPBBUCMD
            AdpBbuCmd 
            ---------

Syntax: 
    megacli adpbbucmd an|a0,1,2|aall  

Syntax: 
    megacli adpbbucmd getbbustatus an|a0,1,2|aall  

Syntax: 
    megacli adpbbucmd getbbucapacityinfo an|a0,1,2|aall  

Syntax: 
    megacli adpbbucmd getbbudesigninfo an|a0,1,2|aall  

Syntax: 
    megacli adpbbucmd getbbuproperties an|a0,1,2|aall  

Syntax: 
    megacli adpbbucmd bbulearn an|a0,1,2|aall  

Syntax: 
    megacli adpbbucmd bbumfgsleep an|a0,1,2|aall  

Syntax: 
    megacli adpbbucmd bbumfgseal an|a0,1,2|aall  

Syntax: 
    megacli adpbbucmd getbbumodes  an|a0,1,2|aall  

Syntax: 
    megacli adpbbucmd schedulelearn dsbl|info|[starttime ddd hh] an|a0,1,2|aall 

Syntax: 
    megacli adpbbucmd getggeepdata offset [hexaddress] numbytes n an|a0,1,2|aall 

Syntax: 
    megacli adpbbucmd setbbuproperties f <filename> an|a0,1,2|aall

Description: 
       Command manages BBU on the selected adapter(s).
        The possible parameters are:
        AdpBbuCmd: Command displays complete information about the BBU
                   such as : status, capacity, design information and properties
        GetBbuStatus: Displays complete information about the BBU status.
                             such as the temperature and voltage.
        GetBbuCapacityInfo: Command displays BBU capacity information. 
        GetBbuDesignInfo: Displays information about the BBU design parameters.
        GetBbuProperties: Command displays current properties of the BBU. 
        BbuLearn: Command Starts the learning cycle on the BBU. 
        getBbumodes: Command display list of bbu mode .
                such as:ID, service time, retention time etc. 
        BbuMfgSleep: Command Places the battery in Low-Power Storage mode. 
        GetGGEEPData: Returns the data of EEPROM starting from "Offset" 
              with n= number of bytes retrieved 
        ScheduleLearn: Scheduling of Battery Learn Cycle on selected Adapter.
            Dsbl: Disable the Battery learn cycle.
            Info: Display Scheduling information.
        StartTime: Schedule and enable the Battery Learn Cycle 
                Accepting Format :- 'DDD hh'.
               'DDD' is day of the week(SUN,MON...SAT). And 'hh' is 0-23 hour.
        SetBbuProperties: Sets the BBU properties on the selected adapter(s) 
                after reading from the ini file. 
        The ini file contains the information in the following formats:
            learnDelayInterval = X
               # X: Time in hours Not greater than 7 days or 168 hours.
            autoLearnMode = Y
               # Y: 0 - Enabled, 1 - Disabled, 2 - WarnViaEvent.
            bbuMode = Z
 # Z: 1 to 255. For gets all supported bbu modes fire 'Adpbbucmd getBbumodes' command.

Convention:   
          -aN         N specifies the adapter number for the command.
          -a0,1,2     Specifies the command is for adapters 0, 1, and 2. 
                        More than one adapter can be selected.
          -aALL       Specifies the command is for all adapters.
=============================================================================
ADPBIOS
            AdpBIOS
            -------

Syntax: 
    megacli adpbios enbl |dsbl | soe | be | hcoe | hsm |  enblautoselectbootld | dsblautoselectbootld | dsply an|a0,1,2|aall 

Description: 
    Sets BIOS options, the following are the settings which can be selected on a single adapter, multiple adapters, or all adapters:-Enbl, -Dsbl, -Dsply:Enables, disables or displays BIOS status.
    The possible parameters are:
    SOE: Stops on BIOS errors during POST for selected adapter(s). When set to -SOE, BIOS stops in case of a problem with the configuration. This gives the option to enter the configuration utility to resolve the problem. This is available only when BIOS is enabled.
    BE: Bypasses BIOS errors during POST. This is available only when BIOS is enabled.
    HCOE: Headless Continue on Error. 
    HSM:  Headless Safe Mode. 
    EnblAutoSelectBootLd/DsblAutoSelectBootLd : Enable/Disable Auto Select Boot option.

Convention:   
    -aN         N specifies the adapter number for the command.
    -a0,1,2     Specifies the command is for adapters 0, 1, and 2. You can 
                    select two or more adapters in this manner.
    -aALL       Specifies the command is for all adapters.
=============================================================================
ADPBOOTDRIVE
            AdpBootDrive
            ------------

Syntax: 
    megacli adpbootdrive {set {lx | physdrv "[e0:s0]}}|get an|a0,1,2|aall

Description: 
        Sets or displays the bootable virtual disk ID
        The possible parameters are:
        Set: Sets the virtual disk as bootable so that during the next reboot, the BIOS will look for a boot sector in the specified virtual disk.
        Get: Displays the bootable virtual disk ID.

Convention:   
          -aN         N specifies the adapter number for the command.
          -a0,1,2     Specifies the command is for adapters 0, 1, and 2. You can 
                      select two or more adapters in this manner.
          -aALL       Specifies the command is for all adapters.
          -PhysDrv[E0:S0,E1:S1....]  List of physical drives, E specifies enclosure 
                     id and S specifies Slot number of physical drive.  
=============================================================================
ADPCACHEFLUSH
            AdpCacheFlush
            -------------

Syntax: 
    megacli adpcacheflush an|a0,1,2|aall

Description: 
        Flush the adapter cache on the selected adapter(s).

Convention:   
          -aN         N specifies the adapter number for the command.
          -a0,1,2     Specifies the command is for adapters 0, 1, and 2. You can 
                      select two or more adapters in this manner.
          -aALL       Specifies the command is for all adapters.
=============================================================================
ADPCCSCHED
            AdpCcSched
            ----------

Syntax: 
    megacli adpccsched dsbl|info|{modeconc | modeseq "[excludeld ln|l0,1,2]
           [-SetStartTime yyyymmdd hh ] [-SetDelay val ] } -aN|-a0,1,2|-aALL

Description: 
        Schedules check consistency on the logical drive of given adapter.
        The possible parameters are:
        Dsbl: Disables Scheduled CC for the given adapter(s).
        Info: Get Scheduled CC Information for the given adapter(s). 
        ModeConc: Scheduled CC on all LDs concurrently for the given adapter(s)..
        ModeSeq: Scheduled CC on LDs sequentially for the given adapter(s).
        ExcludeLd: Specify the LD numbers not included in scheduled CC. The new list will overwrite the existing list stored on the controller. This is optional.
        StartTime: Set the next start time. The date is in the format of yyyymmdd in decimal digits and followed by a decimal number for the hour between 0 ~ 23 inclusively. This is optional.
        SetDelay: Set the execution delay between executions for the given adapter(s). This is optional.
            Values: Value is the length of delay in hours. Value of 0 means continuous execution.

Convention:   
          -aN         N specifies the adapter number for the command.
          -a0,1,2     Specifies the command is for adapters 0, 1, and 2. You can 
                      select two or more adapters in this manner.
          -aALL       Specifies the command is for all adapters.
=============================================================================
ADPCOUNT
            AdpCount
            --------

Syntax: 
    megacli adpcount 

Description: 
        Displays the number of controllers supported on the system and returns 
        the number to the operating system.
=============================================================================
ADPDIAG
            AdpDiag
            -------

Syntax: 
    megacli adpdiag [val] an|a0,1,2|aall

Description: 
        Sets the amount of time for the adapter's diagnostic to run.
        Val: Time in second.

Convention:   
          -aN         N specifies the adapter number for the command.
          -a0,1,2     Specifies the command is for adapters 0, 1, and 2. You can 
                      select two or more adapters in this manner.
          -aALL       Specifies the command is for all adapters.
=============================================================================
ADPDOWNGRADE
            AdpDowngrade command
            ---------------------------

Syntax: 
    megacli adpdowngrade an|a0,1,2|aall

Description: 
          This command downgrades MR controller to iMR mode on next reboot if controller has iMR firmware in flash and no memory is found on next reboot.
          -aN         N specifies the adapter number for the command.
          -a0,1,2     Specifies the command is for adapters 0, 1, and 2. More than one adapter can be selected.
          -aALL       Specifies the command is for all adapters.
=============================================================================
ADPEVENTLOG
            AdpEventLog
            -----------

Syntax: 
    megacli adpeventlog geteventloginfo an|a0,1,2|aall

Syntax: 
    megacli adpeventlog getevents {info warning critical fatal} {f <filename>} an|a0,1,2|aall

Syntax: 
    megacli adpeventlog getsinceshutdown {info warning critical fatal} {f <filename>} an|a0,1,2|aall

Syntax: 
    megacli adpeventlog getsincereboot {info warning critical fatal} {f <filename>} an|a0,1,2|aall

Syntax: 
    megacli adpeventlog includedeleted {info warning critical fatal} {f <filename>} an|a0,1,2|aall

Syntax: 
    megacli adpeventlog getlatest n {info warning critical fatal} {f <filename>} an|a0,1,2|aall

Syntax: 
    megacli adpeventlog getccincon f <filename> lx|l0,2,5...|lall an|a0,1,2|aall

Syntax: 
    megacli adpeventlog clear an|a0,1,2|aall

Description: 
        Command manages event log entries. 
        The possible parameters are:
        GetEventlogInfo: Displays overall event information such as total number of events, newest sequence number, oldest sequence number, shutdown sequence number, reboot sequence number, and clear sequence number. 
        GetEvents: Gets event log entry details. The information shown consists of total number of entries available at firmware side since the last clear and details of each entries of the error log. Start_entry specifies the initial event log entry when displaying the log.
        GetSinceShutdown: Displays all the events since last controller shutdown.
        GetSinceReboot: Displays all the events since last adapter reboot.
        IncludeDeleted: Displays all events, including deleted events.
        GetLatest: Displays the latest number of events, if any exist. The event data will be writtent to the file in reverse order.
        Clear: Clears the event log for the selected adapter(s).

Convention:   
          -aN          :N specifies the adapter number for the command.
          -a0,1,2     :Specifies the command is for adapters 0, 1, and 2. More than one adapter can be selected.
          -aALL      :Specifies the command is for all adapters.
          -info          :Informational message. No user action is necessary.
          -warning   :Some component may be close to a failure point.
          -critical     :A component has failed, but the system has not lost data.
          -fatal        :A component has failed, and data loss has occurred or will occur.
=============================================================================
ADPFACDEFSET
            AdpFacDefSet
            ------------

Syntax: 
    megacli adpfacdefset an

Description: 
        Command sets the factory defaults on the selected adapter(s).

Convention:   
          -aN         N specifies the adapter number for the command.
=============================================================================
ADPFWFLASH
            AdpFwFlash
            ----------

Syntax: 
    megacli adpfwflash f filename [resetnow] [nosigchk] [noverchk] [fwtype n]an| a0,1,2|aall

Description: 
        Flashes the firmware with the ROM file specified at the command line.
        The possible parameters are:
        ResetNow: Firmware will not initiate Online Firmware flash        NoSigChk: option forces the application to flash the firmware even if the check word on the file does not match the required check word for the adapter. This option flashes the firmware only if the existing firmware version on the adapter is lower than the version on the ROM image.
        NoVerChk: also, the application flashes the adapter firmware without checking the version of the firmware image. The version check applies only to the firmware (APP.ROM) version.
        FwType: adapter firmware type. Give the value of Fw-type in number.  
        n: 0:- App or defaut, 1:- TMMC
        This command also supports the Mode 0 flash functionality. For Mode 0 flash, the adapter number is not valid. There are two possible methods:
        - Select which adapter to flash after the adapters are detected.
        - Flash the firmware on all present adapters.
        XML output data is generated by this option.

Convention:   
          -aN         N specifies the adapter number for the command.
          -a0,1,2     Specifies the command is for adapters 0, 1, and 2. More than one adapter can be selected.
          -aALL       Specifies the command is for all adapters.
=============================================================================
ADPGETCONNECTORMODE
            AdpGetConnectorMode
            -------------------

Syntax: 
    megacli adpgetconnectormode connectorn|connector0,1|connectorall an|a0,1,2|aall

Description: 
        Command display connector mode(Internal/External) on selected controllers.

Convention:   
          -aN         N specifies the adapter number for the command.
          -a0,1,2     Specifies the command is for adapters 0, 1, and 2. More than one adapter can be selected.
          -aALL       Specifies the command is for all adapters.
=============================================================================
ADPGETPCIINFO
            AdpGetPciInfo   
            ---------

Syntax: 
    megacli adpgetpciinfo an|a0,1,2|aall

Description: 
        Command retrieve bus number, Device number and Functional number of the adapter 

Convention:   
          -aN         N specifies the adapter number for the command.
          -a0,1,2     Specifies the command is for adapters 0, 1, and 2. More than one adapter can be selected.
          -aALL       Specifies the command is for all adapters.
=============================================================================
ADPGETPROP
            AdpGetProp
            ----------

Syntax: 
    megacli adpgetprop  cacheflushinterval | forcesgpio | rebuildrate 
    | PatrolReadRate | BgiRate | CCRate | ReconRate | SpinupDriveCount 
    | SpinupDelay | CoercionMode | ClusterEnable | PredFailPollInterval 
    | BatWarnDsbl | EccBucketSize | EccBucketLeakRate | EccBucketCount 
    | AbortCCOnError | AlarmDsply | SMARTCpyBkEnbl | SSDSMARTCpyBkEnbl 
    | NCQDsply | MaintainPdFailHistoryEnbl | RstrHotSpareOnInsert 
    | DisableOCR | EnableJBOD | DsblCacheBypass
    | BootWithPinnedCache | enblPI | PreventPIImport | AutoEnhancedImportDsply | AutoDetectBackPlaneDsbl 
    | ExposeEnclDevicesEnbl | EnblSpinDownUnConfigDrvs | SpinDownTime 
    | DefaultSnapshotSpace | DefaultViewSpace | AutoSnapshotSpace 
    | CopyBackDsbl | LoadBalanceMode | UseFDEOnlyEncrypt | UseDiskActivityForLocate 
    | DefaultLdPSPolicy | DisableLdPsInterval | DisableLdPsTime | SpinUpEncDrvCnt | SpinUpEncDelay   
    | PrCorrectUncfgdAreas | ENABLEEGHSP | ENABLEEUG | ENABLEESMARTER | Perfmode | PerfmodeValues 
    | DPMenable | SupportSSDPatrolRead -aN|-a0,1,2|-aALL 

Description: 
        Displays selected adapter properties. 
        The possible settings are: 
        CacheFlushInterval: Returns cache flush interval in seconds. 
            Values: 0 to 255 
        RebuildRate: Rebuild rate. 
            Values: 0 to 100 
        PatrolReadRate: Patrol read rate. 
            Values: 0 to 100 
        BgiRate: Background initilization rate. 
            Values: 0 to 100 
        CCRate: Consistency check rate. 
            Values: 0 to 100 
        ReconRate: Reconstruction rate. 
            Values: 0 to 100 
        SpinupDriveCount: Max number of drives to spin up at one time. 
            Values: 0 to 255 
        SpinupDelay: Number of seconds to delay among spinup groups. 
            Values: 0 to 255 
        CoercionMode: Drive capacity coercion mode. 
            Values: 0 - None 
                    1 - 128 Mbytes 
                    2 - 1 Gbyte 
        ClusterEnable: Clustering is enabled or disabled. 
            Values: 0 - Disabled 
                    1 - Enabled 
        PredFailPollInterval: Number of seconds between predicted fail polls. 
            Values: 0 to 65535 
        BatWarnDsbl: Disable warnings for missing battery or missing hardware. 
            Values: 0 - Disabled 
                    1 - Enabled 
        EccBucketSize: Size of ECC single-bit-error bucket. 
            Values: 0 to 255 
        EccBucketLeakRate: ECC single-bit-error bucket leak rate. 
            Values: 0 to 65535 minutes 
        EccBucketCount: Count of single-bit ECC errors currently in bucket. 
            Values: 0 to 65535 
        AbortCCOnError: Enable aborting check consistency on error. 
            Values: 0 - Disabled 
                    1 - Enabled 
        AlarmDsply: Returns alarm setting
            Values: 0 - Disabled 
                    1 - Enabled 
                    2 - Silenced 
                    3 - Missing 
        SMARTCpyBkEnbl: Copyback on SMART error setting. 
            Values: 0 - Disabled 
                    1 - Enabled 
        SSDSMARTCpyBkEnbl: Copyback to SSD on SMART error setting. 
            Values: 0 - Disabled
                    1 - Enabled.
        JBOD: 
            Values: 0 - Disabled 
                    1 - Enabled 
        CacheBypass: 
            Values: 0 - Enabled 
                    1 - Disabled 
        NCQDsply: Returns NCQ setting. 
            Values: 0 - Enabled 
                    1 - Disabled 
        MaintainPdFailHistoryEnbl: Enables tracking of bad PDs across reboot; 
                    will also show failed LED status for missing bad drives. 
            Values: 0 - Disabled 
                    1 - Enabled 
        RstrHotSpareOnInsert: 
            Values: 0 - Do not restore hot spare on insertion 
                    1 - Restore hot spare on insertion 
        EnblSpinDownUnConfigDrvs: Spin down unconfigured drives option. 
            Values: 0 - Disabled 
                    1 - Enabled 
        DisableOCR:
            Values: 0 - Online controller reset enabled 
                    1 - Online controller reset disabled 
        BootWithPinnedCache: 
            Values: 0 - Do not allow controller to boot with pinned cache 
                    1 - Allow controller to boot with pinned cache 
       enblPI : Active protection information.
            Values: 0 - Disable SCSI PI for controller
                    1 - Enable SCSI PI for controller 
        PreventPIImport: Prevent import of SCSI DIF protected logical disks.
            values : 0 or 1 
        AutoEnhancedImportDsply: Foreign configuration import auto mode option.
            Values: 0 - Disabled 
                    1 - Enabled 
        AutoDetectBackPlaneDsbl: Get auto-detect options for the back-plane. 
            Values: 0 - Enabled Auto Detect of SGPIO and i2c SEP 
                    1 - Disabled Auto Detect of SGPIO 
                    2 - Disabled Auto Detect of i2c SEP 
                    3 - Disabled Auto Detect of SGPIO and i2c SEP 
       ExposeEnclDevicesEnbl:  Enable device drivers to expose enclosure devices.
            Values: 0 - Expose enclosure devices 
                    1 -Hide enclosure devices 
        CopyBackDsbl: 
            Values: 0 - Enabled 
                    1 - Disabled 
        LoadBalanceMode: 
            Values: 0 - Auto Load balance mode 
                    1 - Disable Load balance mode 
        UseFDEOnlyEncrypt: Applies if disk or controller HW support encryption 
            Values: 0 - FDE and controller encryption both allowed 
                    1 - Only support FDE encryption, prohibit controller 
        DsblSpinDownHsp: Disable spin down Hot spares option. 
            Values: 0 - Disabled i.e. spin down hot spares
                    1 - Enabled i.e. do not spin down hot spares.
        SpinDownTime: Spin down time in minutes. i.e After SpinDownTime, firmware will start spinning down unconfigured good drives and hotspare depending on the DsblSpinDownHsp option.
            Values: 30 to 65535
        DefaultSnapshotSpace: Default Snapshot Space in percentage.
        DefaultViewSpace: Default View Space in percentage.
        AutoSnapshotSpace: Default Auto Snapshot Space in percentage.
        UseDiskActivityForLocate: Use disk activity to locate PD in Chenbro backplane
        DefaultLdPSPolicy: Default LD power savings policy 
        DisableLdPsInterval: LD power savings are disabled for yy hours beginning at disableLdPSTime 
        DisableLdPsTime: LD power savings shall be disabled at xx minutes from 12:00am 
        SpinUpEncDrvCnt: Maximum number of drives within an enclosure to spin up at one time 
        SpinUpEncDelay: Number of seconds to delay among spinup groups within an enclosure 
        PrCorrectUncfgdAreas: Correct media errors during PR 
            Values: 0- Disabled. 
                    1 - Enabled. 
        DPMenable: 
            Values: 0 - Disabled 
                    1 - Enabled 
        SupportSSDPatrolRead: 
            Values: 0 - Disabled 
                    1 - Enabled 

Convention:   
        ENABLEEGHSP: Enable Emergency Global Hot spares option. 
            Values: 0 - Disabled i.e.Disabled Emergency Global hot spares
                    1 - Enabled i.e. Enabled Emergency Global hot spares.
        ENABLEEUG: Enable Emergency UG as a Spare option. 
            Values: 0 - Disabled i.e.Disabled Emergency UG as a hot spares
                    1 - Enabled i.e. Enabled Emergency UG as a hot spares.
        ENABLEESMARTER: Enable Emergency spares as a SMARTER option. 
            Values: 0 - Disabled i.e.Disabled Emergency spares as a SMARTER
                    1 - Enabled i.e. Enabled Emergency spares as a SMARTER.
       Perfmode: Performance Tuning.
            Values: 0 - BestIOPS 
                    1 - Least Latency 
       MaxFlushLines: Maximum Number of Flushes.
            Values: 0 - 255 
       NumIOsToOrder: Frequency at which Ordered I/Os should be issued per disk drive.
            Values: 0 - 25 
        ForceSGPIO: 
            Values: 0 - Disabled 
                    1 - Enabled 
          -aN         N specifies the adapter number for the command. 
          -a0,1,2     Specifies the command is for adapters 0, 1, and 2. You 
                      can select two or more adapters in this manner. 
          -aALL       Specifies the command is for all adapters. 
=============================================================================
ADPGETTIME
            AdpGetTime
            ----------

Syntax: 
    megacli adpgettime an|a0,1,2|aall

Description: 
        Displays selected adapter time and date. This command uses a 24-hour format.
        For example, 7 p.m. would display as 19:00:00.

Convention:   
          -aN         N specifies the adapter number for the command.
          -a0,1,2     Specifies the command is for adapters 0, 1, and 2. You can 
                      select two or more adapters in this manner.
          -aALL       Specifies the command is for all adapters.
=============================================================================
ADPPR
            AdpPR
            -----

Syntax: 
    megacli adppr dsbl|enblauto|enblman|start|stop|suspend|resume|info|ssdpatrolreadenbl |ssdpatrolreaddsbl |{setdelay val}| an|a0,1,2|aall

Description: 
        Sets Patrol Read option on a single, multiple, or all adapter's. Patrol Read will not start on degraded or undergoing Initialization/Consistency Check.
        The possible parameters are:
        Dsbl: Disables Patrol Read for the selected adapter(s).
        EnblAuto: Enables Patrol Read automatically for the selected adapter(s). This means Patrol Read will start automatically on the scheduled intervals.
        EnblMan: Enables Patrol Read manually for the selected adapter(s). This means that Patrol Read does not start automatically; it has to be started manually by selecting the Start command. 
        Start: Starts Patrol Read for the selected adapter(s). 
        Suspend: Suspend Patrol Read for the selected adapter(s). 
        Resume: Resume Patrol Read for the selected adapter(s). 
        Stop: Stops Patrol Read for the selected adapter(s). 
        Info: Displays the following Patrol Read information for the selected adapter(s): 
            - Patrol Read operation mode 
            - Patrol Read execution delay value
            - Patrol Read status
        SSDPatrolReadEnbl: Enable Patrol Read that include VDs constituting only SSD drives 
        SSDPatrolReadDsbl: Disable Patrol Read that include VDs constituting only SSD drives 

Convention:   
          -aN         N specifies the adapter number for the command.
          -a0,1,2     Specifies the command is for adapters 0, 1, and 2. You can 
                      select two or more adapters in this manner.
          -aALL       Specifies the command is for all adapters.
=============================================================================
ADPSETCONNECTORMODE
            AdpSetConnectorMode
            -------------------

Syntax: 
    megacli adpsetconnectormode internal|external|auto connectorn|connector0,1|connectorall an|a0,1,2|aall

Description: 
        Command sets connector mode on selected controllers.
        The possible parameters are:
        External: Set Multiplexer to select External port. e.g. scan external bus.
        Internal: Set Multiplexer to select Internal port. e.g. scan SAS bus for connected devices.

Convention:   
          -aN         N specifies the adapter number for the command.
          -a0,1,2     Specifies the command is for adapters 0, 1, and 2. More than one adapter can be selected.
          -aALL       Specifies the command is for all adapters.
=============================================================================
ADPSETPROP
            AdpSetProp
            ----------

Syntax: 
    megacli adpsetprop {cacheflushinterval val} | { rebuildrate val} 
    | {PatrolReadRate -val} | {BgiRate -val} | {CCRate -val} 
    | {ReconRate -val} | {SpinupDriveCount -val} | {SpinupDelay -val} 
    | {CoercionMode -val} | {ClusterEnable -val} | {PredFailPollInterval -val} 
    | {BatWarnDsbl -val} | {EccBucketSize -val} | {EccBucketLeakRate -val} 
    | {AbortCCOnError -val} | AlarmEnbl | AlarmDsbl | AlarmSilence 
    | {SMARTCpyBkEnbl -val} | {SSDSMARTCpyBkEnbl -val} | NCQEnbl | NCQDsbl 
    | {MaintainPdFailHistoryEnbl -val} | {RstrHotSpareOnInsert -val} 
    | {EnblSpinDownUnConfigDrvs -val} |{DefaultSnapshotSpace -Val%}|{AutoSnapshotSpace -Val%} 
    | {DisableOCR -val} | {BootWithPinnedCache -val} | {enblPI -val} | {PreventPIImport -val} 
    | AutoEnhancedImportEnbl | AutoEnhancedImportDsbl | {ExposeEnclDevicesEnbl -val} | {CopyBackDsbl -val} 
    | {AutoDetectBackPlaneDsbl -val} | {LoadBalanceMode -val}| {DefaultViewSpace -Val%} 
    | {UseFDEOnlyEncrypt -val} | {DsblSpinDownHsp -val} | {SpinDownTime -val}| {Perfmode -val}
    | {PerfMode -val MaxFlushLines -val NumIOsToOrder -val} -aN|-a0,1,2|-aALL 
    | {EnableJBOD -val} | {DsblCacheBypass -val} 
    | {useDiskActivityForLocate -val} | {SpinUpEncDrvCnt -val} 
    | {SpinUpEncDelay -val}| {PrCorrectUncfgdAreas -val} | {ENABLEEGHSP -val} | {ENABLEEUG -val} 
    | {ENABLEESMARTER -val} | {DPMenable -val} | {SupportSSDPatrolRead -val} |  {ForceSGPIO -val}
     -aN|-a0,1,2|-aALL 

Description: 
        Command sets the properties on the selected adapter(s). 
        The possible settings are: 
        CacheFlushInterval: Cache flush interval in seconds. 
            Values: 0 to 255 
        RebuildRate: Rebuild rate. 
            Values: 0 to 100 
        PatrolReadRate: Patrol read rate. 
            Values: 0 to 100 
        BgiRate: Background initilization rate. 
            Values: 0 to 100 
        CCRate: Consistency check rate. 
            Values: 0 to 100 
        ReconRate: Reconstruction rate. 
            Values: 0 to 100 
        SpinupDriveCount: Max number of drives to spin up at one time. 
            Values: 0 to 255 
        SpinupDelay: Number of seconds to delay among spinup groups. 
            Values: 0 to 255 
        CoercionMode: Drive capacity Coercion mode. 
            Values: 0 - None 
                    1 - 128 Mbytes 
                    2 - 1 Gbyte 
        ClusterEnable: Clustering is enabled or disabled. 
            Values: 0 - Disabled 
                    1 - Enabled 
        PredFailPollInterval: Number of seconds between predicted fail polls. 
            Values: 0 to 65535 
        BatWarnDsbl: Disable warnings for missing battery or missing hardware. 
            Values: 0 - Disabled 
                    1 - Enabled 
        EccBucketSize: Set size of ECC single-bit-error bucket. 
            Values: 0 to 255 
        EccBucketLeakRate: ECC single-bit-error bucket leak rate. 
            Values: 0 to 65535 minutes 
        AbortCCOnError: Enable aborting check consistency on error. 
            Values: 0 - Disabled 
                    1 - Enabled 
        AlarmEnbl: Set alarm to Enabled. 
        AlarmDsbl: Set alarm to Disabled. 
        AlarmSilence: Silence an active alarm. 
        SMARTCpyBkEnbl: Copyback on SMART error Enabled. 
            Values: 0 - Disabled 
                    1 - Enabled 
        SSDSMARTCpyBkEnbl: Copyback to SSD on SMART error Enabled. 
            Values: 0 - Disabled 
                    1 - Enabled 
        NCQEnbl: Enables NCQ option on controller. 
        NCQDsbl: Disables NCQ option on controller. 
        MaintainPdFailHistoryEnbl: Enable tracking of bad PDs across reboot; 
                    will also show failed LED status for missing bad drives. 
            Values: 0 - Disabled 
                    1 - Enabled 
        RstrHotSpareOnInsert: 
            Values: 0 - Do not restore hot spare on insertion 
                    1 - Restore hot spare on insertion 
        EnblSpinDownUnConfigDrvs: Spin down un-configured drives option. 
            Values: 0 - Disabled 
                    1 - Enabled 
        DisableOCR: 
            Values: 0 - Online controller reset enabled 
                    1 - Online controller reset disabled 
        BootWithPinnedCache: 
            Values: 0 - Do not allow controller to boot with pinned cache 
                    1 - Allow controller to boot with pinned cache 
       enblPI : Active protection information.
            Values: 0 - Disable SCSI PI for controller
                    1 - Enable SCSI PI for controller 
        PreventPIImport: Prevent import of SCSI DIF protected logical disks.
            values : 0 or 1 
        AutoEnhancedImportEnbl: Enable automatic foreign configuration import. 
        AutoEnhancedImportDsbl: Disable automatic foreign configuration import.
       ExposeEnclDevicesEnbl:  Enable device drivers to expose enclosure devices.
            Values: 0 - Expose enclosure devices 
                    1 - Hide enclosure devices 
        CopyBackDsbl: 
            Values: 0 - Enable Copyback 
                    1 - Disable Copyback 
        EnableJBOD  : 
            Values: 0 - Disable JBOD mode 
                    1 - Enable JBOD mode 
        DsblCacheBypass  : 
            Values: 0 - Enable Cache Bypass 
                    1 - Disable Cache Bypass 
        AutoDetectBackPlaneDsbl: Set auto-detect options for the back-plane. 
            Values: 0 - Enable Auto Detect of SGPIO and i2c SEP 
                    1 - Disable Auto Detect of SGPIO 
                    2 - Disable Auto Detect of i2c SEP 
                    3 - Disable Auto Detect of SGPIO and i2c SEP 
        LoadBalanceMode: 
            Values: 0 - Auto Load balance mode 
                    1 - Disable Load balance mode 
        UseFDEOnlyEncrypt: Applies if disk or controller HW support encryption 
            Values: 0 - FDE and controller encryption both allowed 
                    1 - Only support FDE encryption, prohibit controller 
        DsblSpinDownHsp: Disable spin down Hot spares option. 
            Values: 0 - Disabled i.e. spin down hot spares
                    1 - Enabled i.e. do not spin down hot spares.
        SpinDownTime: Spin down time in minutes. i.e After SpinDownTime, firmware will start spinning down unconfigured good drives and hotspare depending on the DsblSpinDownHsp option.
            Values: 30 to 65535
       Perfmode: Performance Tuning.
            Values: 0 - BestIOPS 
                    1 - Least Latency 
       MaxFlushLines: Maximum Number of Flushes.
            Values: 0 - 255 
       NumIOsToOrder: Frequency at which Ordered I/Os should be issued per disk drive.
            Values: 0 - 25 
        DefaultSnapshotSpace: Default Snapshot Space in percentage.
        DefaultViewSpace: Default View Space in percentage.
        AutoSnapshotSpace: Default Auto Snapshot Space in percentage.
        useDiskActivityForLocate: 
            Values: 0 - Disable use of disk activity to locate a physical disk in Chenbro backplane 
                    1 - Enable use of disk activity to locate a physical disk in Chenbro backplane 
        SpinUpEncDrvCnt: Max number of drives within an enclosure to spin up at one time. 
            Values: 0 to 255 
        SpinUpEncDelay: Number of seconds to delay among spinup groups within an enclosure 
            Values: 0 to 255 
        PrCorrectUncfgdAreas: Correct media errors during PR 
            Values: 0 - Correcting Media error during PR is disabled. 
                    1 -Correcting Media error during PR is allowed. 
        DPMenable  : 
            Values: 0 - Disable Drive Performance Monitoring 
                    1 - Enable Drive Performance Monitoring 
        SupportSSDPatrolRead  : 
            Values: 0 - Disable Patrol read fo SSD drives 
                    1 - Enable Patrol read fo SSD drives 

Convention:   
        ENABLEEGHSP: Enable Emergency Global Hot spares option. 
            Values: 0 - Disabled i.e.Disabled Emergency Global hot spares
                    1 - Enabled i.e. Enabled Emergency Global hot spares.
        ENABLEEUG: Enable Emergency UG as a Spare option. 
            Values: 0 - Disabled i.e.Disabled Emergency UG as a hot spares
                    1 - Enabled i.e. Enabled Emergency UG as a hot spares.
        ENABLEESMARTER: Enable Emergency spares as a SMARTER option. 
            Values: 0 - Disabled i.e.Disabled Emergency spares as a SMARTER
                    1 - Enabled i.e. Enabled Emergency spares as a SMARTER.
        ForceSGPIO:  
            Values: 0 - Disabled 
                    1 - Enabled 
          -aN         N specifies the adapter number for the command. 
          -a0,1,2     Specifies the command is for adapters 0, 1, and 2. You 
                      can select two or more adapters in this manner. 
          -aALL       Specifies the command is for all adapters. 
=============================================================================
ADPSETTIME
            AdpSetTime
            ----------

Syntax: 
    megacli adpsettime yyyymmdd hh:mm:ss an

Description: 
        Sets the time and date on selected adapter, this command uses a 24-hour format. For 
        example, 7 p.m. displays as 19:00:00. The order of date and time is reversible.

Convention:   
          -aN         N specifies the adapter number for the command.
          -a0,1,2     Specifies the command is for adapters 0, 1, and 2. You can 
                      select two or more adapters in this manner.
          -aALL       Specifies the command is for all adapters.
=============================================================================
ADPSETVERIFY
            AdpSetVerify
            ------------

Syntax: 
    megacli adpsetverify f filename an|a0,1,2|aall

Description: 
        Validates adapter configuration using given input(ini) file, input(ini) file contains all the adapter settings information. 

Convention:   
          -aN         N specifies the adapter number for the command.
          -a0,1,2     Specifies the command is for adapters 0, 1, and 2. You can 
                      select two or more adapters in this manner.
          -aALL       Specifies the command is for all adapters.
=============================================================================
ADPSHUTDOWN
            AdpShutDown     
            ------------

Syntax: 
    megacli adpshutdown an|a0,1,2|aall
Descritption: 
    Shutdown the selected Adapter(s).All background operations are put on 
    hold for resume. The controller cache is flushed, all disk drive 
    caches are flushed, and the on-disk configuration is closed to  
    indicate redundancy data is consistent. Further writes will 
    cause the system to reopen the configuration,thus undoing the effects
    of the shutdown command.

Convention:   
          -aN         N specifies the adapter number for the command.
          -a0,1,2     Specifies the command is for adapters 0, 1, and 2. You can 
                      select two or more adapters in this manner.
          -aALL      Specifies the command is for all adapters. 
=============================================================================
CACHECADE
            Cachecade
               ----------

Syntax: 
    megacli cachecade assign|remove lx|l0,1,2|lall an|a0,1,2|aall

Description: 
        This command assigns or removes the association of VDs with the Cachecade pool.

Convention:   
          -aN         N specifies the adapter number for the command.
          -a0,1,2     Specifies the command is for adapters 0, 1, and 2. More than one adapter can be selected.
          -aALL       Specifies the command is for all adapters.
=============================================================================
CFGALLFREEDRV
            CfgAllFreeDrv
            -------------

Syntax: 
    megacli cfgallfreedrv rx [sataonly] [spancount xxx] [wt|wb] [nora|ra|adra] [direct|cached] [cachedbadbbu|nocachedbadbbu] [strpszm] [hspcount xx [hsptype dedicated|enclaffinity|nonrevertible]] | [fde|ctrlbased] [default| automatic| none| maximum| maximumwithoutcaching] "[enblpi] an

Description: 
        Adds all the unconfigured physical drives to RAID level 0, 1, 5, or 6 configuration to a specified adapter. Even if no configuration is present, you have the option to write the configuration to the adapter.
        The possible parameters are:
        Rx[E0:S0,...]: Specifies the RAID level and the physical drive enclosure/slot numbers to construct a disk array.
        WT (Write through), WB (Write back): Selects write policy.
        NORA (No read ahead), RA (Read ahead), ADRA (Adaptive read ahead): Selects read policy.
        Cached, -Direct: Selects cache policy.
        [{CachedBadBBU|NoCachedBadBBU }]: Specifies whether to use write cache when the BBU is bad.
        szXXXXXXXX: Specifies the size for the virtual disk, where XXXX is a decimal number of Mbytes. However, the actual size of the virtual disk may be smaller, because the driver requires the number of blocks from the physical drives in each virtual disk to be aligned to the strip size. If multiple size options are specified, CT will configure the virtual disks in the order of the options entered in the command line. The configuration of a particular virtual disk will fail if the remaining size of the array is too small to configure the virtual disk with the specified size. This option can also be used to create a configuration on the free space available in the array.
        strpszM: Specifies the strip size, where the strip size values are 8, 16, 32, 64, 128, 256, 512, or 1024 Mega Bytes.
        HspType: If HspType is not mentioned it will be a global Hot Spare.
            Dedicated: The new hot spares will be dedicated to the virtual disk used in creating the configuration.
            EnclAffinity: Associates the hot spare to a selected enclosure.
        AfterLdX: This command is optional. By default, the application uses the first free slot available in the virtual disk. This option is valid only if the virtual disk is already used for configuration.
        FDE|CtrlBased: If controller support security feature, this option enables FDE/Ctrl based encryption on virtual disk.  
        [-Default| -Automatic| -None| -Maximum| -MaximumWithoutCaching] : If the controller supports power savings on virtual disk, these options specify the possible levels of power savings that can be applied on a virtual disk. 
        [-enblPI]: Allows to create PIenabled configuration.

Convention:   
          -aN         N specifies the adapter number for the command.
          -a0,1,2     Specifies the command is for adapters 0, 1, and 2. More than one adapter can be selected.
          -aALL       Specifies the command is for all adapters.
=============================================================================
CFGCACHECADEADD
            CfgCacheCadeAdd
            -----------

Syntax: 
    megacli cfgcachecadeadd [rx] physdrv "[e0:s0,...]" {name ldnamestring} [wt|wb|forcedwb] [assign lx|l0,2,5..|lall] an|a0,1,2|aall 

Description: This command is used to create CacheCade which can be used as secondary cache 
        The possible parameters are:
        Rx: Specifies the RAID level.
        Physdrv[E0:S0,...]: Specifies the physical drive enclosure/slot numbers to construct a disk array.
        WT (Write through), WB (Write back), ForcedWB (Forced Write back): Selects write policy.
        [-assign -LX|L0,2,5..|LALL]: Specifies the Virtual disk that is to be cached.

Convention:   
          -aN         N specifies the adapter number for the command.
          -a0,1,2     Specifies the command is for adapters 0, 1, and 2. More than one adapter can be selected.
          -aALL       Specifies the command is for all adapters.
=============================================================================
CFGCACHECADEDEL
            CfgCacheCadeDel
            --------

Syntax: 
    megacli cfgcachecadedel lx|l0,2,5...|lall an|a0,1,2|aall

Description: 
        Command deletes the specified CacheCade on the selected adapter(s).
        Multiple or all CacheCades can be deleted.

Convention:   
          -aN         N specifies the adapter number for the command.
          -a0,1,2     Specifies the command is for adapters 0, 1, and 2. More than one adapter can be selected.
          -aALL       Specifies the command is for all adapters.
=============================================================================
CFGCACHECADEDSPLY
            CfgCacheCadeDsply
            --------

Syntax: 
    megacli cfgcachecadedsply an|a0,1,2|aall

Description: 
        Command displays the existing CacheCade configuration on the selected adapter.

Convention:   
          -aN         N specifies the adapter number for the command.
          -a0,1,2     Specifies the command is for adapters 0, 1, and 2. More than one adapter can be selected.
          -aALL       Specifies the command is for all adapters.
=============================================================================
CFGCLR
            CfgClr
            ------

Syntax: 
    megacli cfgclr [force] an|a0,1,2|aall

Description: 
        Command clears the existing configuration on selected adapter.
        [-Force]: If Specified the Configuration will be cleared even if there are some dirty Cache Lines.

Convention:   
          -aN         N specifies the adapter number for the command.
          -a0,1,2     Specifies the command is for adapters 0, 1, and 2. More than one adapter can be selected.
          -aALL       Specifies the command is for all adapters.
=============================================================================
CFGDSPLY
            CfgDsply
            --------

Syntax: 
    megacli cfgdsply an|a0,1,2|aall

Description: 
        Command displays the existing configuration on the selected adapter.

Convention:   
          -aN         N specifies the adapter number for the command.
          -a0,1,2     Specifies the command is for adapters 0, 1, and 2. More than one adapter can be selected.
          -aALL       Specifies the command is for all adapters.
=============================================================================
CFGEACHDSKRAID0
            CfgEachDskRaid0
            ---------------

Syntax: 
    megacli cfgeachdskraid0 [wt|wb] [nora|ra|adra] [direct|cached] [cachedbadbbu|nocachedbadbbu] [strpszm] [fde|ctrlbased] [default| automatic| none| maximum| maximumwithoutcaching] [cache] "[enblpi] an|a0,1,2|aall

Description: 
        Command configures each physical disk in unconfigured-good state as RAID 0 on the selected adapter.
        [-Cache]: If Specified the virtual disk will be cached by using the Cachepool.
        [-enblPI]: Allows to create PIenabled configuration.

Convention:   
          -aN         N specifies the adapter number for the command.
          -a0,1,2     Specifies the command is for adapters 0, 1, and 2. More than one adapter can be selected.
          -aALL       Specifies the command is for all adapters.
=============================================================================
CFGFOREIGN
            CfgForeign
            ----------

Syntax: 
    megacli cfgforeign scan | [securitykey sssssssssss] an|a0,1,2|aall

Syntax: 
    megacli cfgforeign dsply [x] | [securitykey sssssssssss] an|a0,1,2|aall    

Syntax: 
    megacli cfgforeign preview [x] | [securitykey sssssssssss] an|a0,1,2|aall    

Syntax: 
    megacli cfgforeign import [x] | [securitykey sssssssssss] an|a0,1,2|aall    

Syntax: 
    megacli cfgforeign clear [x]|[securitykey sssssssssss] an|a0,1,2|aall    

Description: 
        Command manages foreign configurations. 
        The possible parameters are:
        Scan: Scans and displays available foreign configurations.
        Preview: Provides a preview of the imported foreign configuration. The foreign configuration ID (FID) is optional.
        Dsply: Displays the foreign configuration.
        Import: Imports the foreign configuration. The FID is optional.
        Clear [FID]: Clears the foreign configuration. The FID is optional.
         X: index of foreign configurations. It is Optional, all by default.
        SecurityKey: Security Key needs to be given if the foreign drive is locked. 
        If multiple keys are required to unlock all the PDs then this command needs to be 
        executed multiple times passing different security keys.

Convention:   
          -aN         N specifies the adapter number for the command.
          -a0,1,2     Specifies the command is for adapters 0, 1, and 2. More than one adapter can be selected.
          -aALL       Specifies the command is for all adapters.
=============================================================================
CFGFREESPACEINFO
            CfgFreeSpaceinfo
            ----------------

Syntax: 
    megacli cfgfreespaceinfo an|a0,1,2|aall

Description: 
        Command displays all the free space available for configuration on the selected adapter(s). The information displayed includes the number of disk groups, the number of spans in each disk group, the number of free space slots in each disk group, the start block, and the size (in both blocks and megabytes) of each free space slot.

Convention:   
          -aN         N specifies the adapter number for the command.
          -a0,1,2     Specifies the command is for adapters 0, 1, and 2. More than one adapter can be selected.
          -aALL       Specifies the command is for all adapters.
=============================================================================
CFGLDADD
            CfgLdAdd
            --------

Syntax: 
    megacli cfgldadd rx"[e0:s0,e1:s1,...]" [wt|wb] [nora|ra|adra] [direct|cached] [cachedbadbbu|nocachedbadbbu] [szxxx [szyyy ...]] [strpszm] [hsp[e0:s0,...]] [afterldx] | [fde|ctrlbased] [default| automatic| none| maximum| maximumwithoutcaching] [cache] [enblpi] [force] an

Description: 
        Command adds a RAID level 0, 1, 5, or 6 to a specified adapter. Even if no configuration is present, you have the option to write the configuration to the adapter.
        The possible parameters are:
        Rx[E0:S0,...]: Specifies the RAID level and the physical drive enclosure/slot numbers to construct a disk array.
        WT (Write through), WB (Write back): Selects write policy.
        NORA (No read ahead), RA (Read ahead), ADRA (Adaptive read ahead): Selects read
        policy.
        Cached, -Direct: Selects cache policy.
        [{CachedBadBBU|NoCachedBadBBU }]: Specifies whether to use write cache when the BBU is bad.
        szXXXXXXXX: Specifies the size for the virtual disk, where XXXX is a decimal number of Mbytes. However, the actual size of the virtual disk may be smaller, because the driver requires the number of blocks from the physical drives in each virtual disk to be aligned to the stripe size. If multiple size options are specified, CT will configure the virtual disks in the order of the options entered in the command line. The configuration of a particular virtual disk will fail if the remaining size of the array is too small to configure the virtual disk with the specified size. This option can also be used to create a configuration on the free space available in the array.
        strpszM: Specifies the strip size, where the strip size values are 8, 16, 32, 64, 128, 256, 512, or 1024 Mega Bytes.
        Hsp[E5:S5,...]: Creates hot spares when you create the configuration. The new hot spares will be dedicated to the virtual disk used in creating the configuration. This option does not allow you to create global hot spares. To create global hot spares, you must use the -PdHsp command with proper subcommands. User can also use this option to create a configuration on the free space available in the virtual disk. 
        AfterLdX: This command is optional. By default, the application uses the first free slot available in the virtual disk. This option is valid only if the virtual disk is already used for configuration.
        Force: This option will force the creation of virtual disk in situations where the application finds that it is convenient to create the virtual disk only with user's consent.
        [-Cache]: If Specified the virtual disk will be cached by using the Cachepool.
        [-enblPI]: Allows to create PIenabled configuration.
        FDE|CtrlBased: If controller support security feature, this option enables FDE/Ctrl based encryption on virtual disk.  
        [-Default| -Automatic| -None| -Maximum| -MaximumWithoutCaching] : If the controller supports power savings on virtual disk, these options specify the possible levels of power savings that can be applied on a virtual disk. 

Convention:   
          -aN         N specifies the adapter number for the command.
          -a0,1,2     Specifies the command is for adapters 0, 1, and 2. More than one adapter can be selected.
          -aALL       Specifies the command is for all adapters.
=============================================================================
CFGLDDEL
            CfgLdDel
            --------

Syntax: 
    megacli cfglddel lx|l0,2,5...|lall [force] an|a0,1,2|aall

Description: 
        Command deletes the specified virtual disk(s) on the selected adapter(s).
        Multiple or all virtual disks can be deleted.
        [-Force]: If Specified the Configuration will be cleared even if there are some dirty Cache Lines.

Convention:   
          -aN         N specifies the adapter number for the command.
          -a0,1,2     Specifies the command is for adapters 0, 1, and 2. More than one adapter can be selected.
          -aALL       Specifies the command is for all adapters.
=============================================================================
CFGRESTORE
            CfgRestore
            ----------

Syntax: 
    megacli cfgrestore f filename an

Description: 
        Reads the configuration from the file and loads it on the adapter. MegaCLI can store or restore all read and write adapter properties, all read and write properties for virtual disks, and the RAID configuration including hot spares. 

Convention:   
          -aN         N specifies the adapter number for the command.
          -a0,1,2     Specifies the command is for adapters 0, 1, and 2. More than one adapter can be selected.
          -aALL       Specifies the command is for all adapters.
        Note:
        - MegaCLI does not validate the setup when restoring the RAID configuration.
        - CfgSave option stores the configuration data and adapter properties in the file. Configuration data has only the device ID and sequence number information of the physical drives used in the configuration. The CfgRestore option will fail if the same device IDs of the physical drives are not present.
=============================================================================
CFGSAVE
            CfgSave
            -------

Syntax: 
    megacli cfgsave f filename an  

Description: 
        Command saves the configuration for the selected adapter(s) to the given filename.

Convention:   
          -aN         N specifies the adapter number for the command.
=============================================================================
CFGSPANADD
            CfgSpanAdd
            ----------

Syntax: 
    megacli cfgspanadd r10 array0"[e0:s0,e1:s1] array1[e0:s0,e1:s1] [arrayx[e0:s0,e1:s1] ...]" [wt|wb] [nora|ra|adra] [direct|cached] [cachedbadbbu|nocachedbadbbu][strpszm][szxxx[szyyy ...]][afterldx]| [fde|ctrlbased] [default| automatic| none| maximum| maximumwithoutcaching] [enblpi] [force]  an

Syntax: 
    megacli cfgspanadd r50 array0"[e0:s0,e1:s1,e2:s2,...]" array1[e0:s0,e1:s1,e2:s2,...] [arrayx[e0:s0,e1:s1,e2:s2,...] ...] [wt|wb] [nora|ra|adra] [direct|cached] [cachedbadbbu|nocachedbadbbu][strpszm][szxxx[szyyy ...]][afterldx] [fde|ctrlbased] [default| automatic| none| maximum| maximumwithoutcaching] [enblpi] [force]  an

Syntax: 
    megacli cfgspanadd r60 array0"[e0:s0,e1:s1,e2:s2,e3,s3...]" array1[e0:s0,e1:s1,e2:s2,e3,s3...] [arrayx[e0:s0,e1:s1,e2:s2,...] ...] [wt|wb] [nora|ra|adra] [direct|cached] [cachedbadbbu|nocachedbadbbu][strpszm][szxxx[szyyy ...]][afterldx] [fde|ctrlbased] [default| automatic| none| maximum| maximumwithoutcaching] [enblpi] [force]  an

Description: 
        Command creates a RAID level 10, 50, or 60 (spanned) configuration from the specified arrays. Even if no configuration is present, you must use this option to write the configuration to the adapter.
        The possible parameters are:
        Rx: Spcecifies the RAID Level.
        ArrayX[E0:S0,...]: Specifies the Array and the physical drive enclosure/slot numbers to construct a disk array.
        WT (Write through), WB (Write back): Selects write policy.
        NORA (No read ahead), RA (Read ahead), ADRA (Adaptive read ahead): Selects read
        policy.
        Cached, -Direct: Selects cache policy.
        [{CachedBadBBU|NoCachedBadBBU }]: Specifies whether to use write cache when the BBU is bad.
        szXXXXXXXX: Specifies the size for the virtual disk, where XXXX is a decimal number of Mbytes. However, the actual size of the virtual disk may be smaller, because the driver requires the number of blocks from the physical drives in each virtual disk to be aligned to the stripe size. If multiple size options are specified, CT will configure the virtual disks in the order of the options entered in the command line. The configuration of a particular virtual disk will fail if the remaining size of the array is too small to configure the virtual disk with the specified size. This option can also be used to create a configuration on the free space available in the array.
        strpszM: Specifies the strip size, where the strip size values are 8, 16, 32, 64, 128, 256, 512, or 1024 Mega Bytes.
        AfterLdX: This command is optional. By default, the application uses the first free slot available in the virtual disk. This option is valid only if the virtual disk is already used for configuration.
        Force: This option will force the creation of virtual disk in situations where the application finds that it is convenient to create the virtual disk only with user's consent.
        FDE|CtrlBased: If controller support security feature, this option enables FDE/Ctrl based encryption on virtual disk.  
        [-Default| -Automatic| -None| -Maximum| -MaximumWithoutCaching] : If the controller supports power savings on virtual disk, these options specify the possible levels of power savings that can be applied on a virtual disk. 
        [-enblPI]: Allows to create PIenabled configuration.

Convention:   
          -aN         N specifies the adapter number for the command.
          -a0,1,2     Specifies the command is for adapters 0, 1, and 2. More than one adapter can be selected.
          -aALL       Specifies the command is for all adapters.
        Note: 
        -   Multiple arrays are specified using the -ArrayX[E0:S0,...] option, Where X starts from 0.
        -   All of the arrays must have the same number of physical drives.
        -   At least two arrays must be provided. The order of options {WT |WB} {NORA | RA | ADRA} {Direct | Cached} is flexible.
        -   Command exits and does not create a configuration if the size(-szXXXXXXXX) or the AfterLd option is specified but the controller does not support slicing in the spanned arrays.
=============================================================================
CHANGESECURITYKEY
            ChangeSecurityKey
            -----------------

Syntax: 
    megacli changesecuritykey oldsecuritykey sssssssssss | securitykey sssssssssss| [passphrase sssssssssss] | [keyid kkkkkkkkkkk] an

Description: 
        Command changes security key on specified controller.
        The possible parameters are:
        OldSecurityKey: It is the old security key used to create security feature on specified controller. 
        SecurityKey: This security key will replace the old security.
        Passphrase: This pass phrase will replace the old pass phrase.
        KeyID: Security key Id of given controller.

Convention:   
          -aN         N specifies the adapter number for the command.
        Note: 
        -   Security key is mandatory and pass phrase is optional.
        -   Security key and pass phrase have special requirements.
        Security key & pass phrase should have 8 - 32 chars, case-sensitive; 1 number, 1 lowercase letter, 1 uppercase letter, 1 non-alphanumeric character (no spaces).
       - In case of Unix based systems, if the character '!' is used as one of the input characters in the value of Security key or pass phrase, it must be preceded by a back slash character('\'). 
=============================================================================
CREATESECURITYKEY
            CreateSecurityKey
            -----------------

Syntax: 
    megacli createsecuritykey securitykey sssssssssss | [passphrase sssssssssss] |[keyid kkkkkkkkkkk] an 

Description: 
        Command enables security feature on specified controller.
        The possible parameters are:
        SecurityKey: Security key will be used to generate lock key when drive security is enabled.
        Passphrase: Pass phrase to provide additional security.
        KeyID: Security key Id.

Convention:   
          -aN         N specifies the adapter number for the command.
        Note: 
        -   Security key is mandatory and pass phrase is optional.
        -   Security key and pass phrase have special requirements.
        Security key & pass phrase should have 8 - 32 chars, case-sensitive; 1 number, 1 lowercase letter, 1 uppercase letter, 1 non-alphanumeric character (no spaces).
       - In case of Unix based systems, if the character '!' is used as one of the input characters in the value of Security key or pass phrase, it must be preceded by a back slash character('\'). 
=============================================================================
DESTROYSECURITYKEY
            DestroySecurityKey
            ------------------

Syntax: 
    megacli destroysecuritykey | [force] an

Description: 
        Command destroys the key completely on specified controller.

Convention:   
          -aN         N specifies the adapter number for the command.
        Force:  This option will force the destroying of the security key otherwise the CLI will give a warning that destroying key will result in data corruption and quit.
=============================================================================
DIRECTPDMAPPING
            DirectPdMapping   
            ---------------

Syntax: 
    megacli directpdmapping enbl|dsbl|dsply an|a0,1,2|aall 

Description: 
        Command sets the mapping mode of physical drive.
        The possible parameters are:
        Enbl: Enables Direct physical drive mapping mode. 
        Dsbl: Disables Direct physical drive mapping mode. 
        Dsply: Displays current state of direct physical drive mapping. 

Convention:   
          -aN         N specifies the adapter number for the command.
          -a0,1,2     Specifies the command is for adapters 0, 1, and 2. More than one adapter can be selected.
          -aALL       Specifies the command is for all adapters.
=============================================================================
DISCARDPRESERVEDCACHE
            DiscardPreservedCache    
            ---------------------

Syntax: 
    megacli discardpreservedcache lx|l0,1,2|lall force an|a0,1,2|aall 

Description: 
        Command discards pinned cache of Vd

Convention:   
          -force         force option must be specified in the command when preserved cache associated with Offline virtual drives must be discarded.          Offline virtual drives will be deleted on discarding the preserved cache associated with them.
          -aN         N specifies the adapter number for the command.
          -a0,1,2     Specifies the command is for adapters 0, 1, and 2. More than one adapter can be selected.
          -aALL       Specifies the command is for all adapters.
=============================================================================
DPMSTAT
                     DPMStat   
                    ------------
MegaCli -DpmStat -Dsply {lct | hist | ra | ext } [-physdrv[E0:S0]] -aN|-a0,1,2|-aALL  
MegaCli -DpmStat -Clear {lct | hist | ra | ext } -aN|-a0,1,2|-aALL  

Description: 
          These commands display or clear the drive performance statistics on the controller.
          -aN         N specifies the adapter number for the command.
          -a0,1,2     Specifies the command is for adapters 0, 1, and 2. More than one adapter can be selected.
          -aALL       Specifies the command is for all adapters.
=============================================================================
ELF
            GetSafeId   
          ----------------

Syntax: 
    megacli elf getsafeid an|a0,1,2|aall

Description: 
        Displays the Safe ID of the controller

Convention:   
          -aN         N specifies the adapter number for the command.
          -a0,1,2     Specifies the command is for adapters 0, 1, and 2. More than one adapter can be selected.
          -aALL       Specifies the command is for all adapters.
            ControllerFeatures   
          ----------------

Syntax: 
    megacli elf controllerfeatures an|a0,1,2|aall

Description: 
        Displays the Advanced Software Options that are enabled on the controller including the ones in trial mode

Convention:   
          -aN         N specifies the adapter number for the command.
          -a0,1,2     Specifies the command is for adapters 0, 1, and 2. More than one adapter can be selected.
          -aALL       Specifies the command is for all adapters.
            ApplyKey   
          ----------------

Syntax: 
    megacli elf applykey key <val> [preview] an|a0,1,2|aall

Description: 
        Applies the Activation Key either in preview mode or in real mode

Convention:   
          -Preview - optional parameter, provides the preview of the Advanced Software Option(s) that gets activated or deactivated after applying the Activation key.
          -aN         N specifies the adapter number for the command.
          -a0,1,2     Specifies the command is for adapters 0, 1, and 2. More than one adapter can be selected.
          -aALL       Specifies the command is for all adapters.
            TransferToVault   
          ----------------

Syntax: 
    megacli elf transfertovault an|a0,1,2|aall

Description: 
        Transfers the Advanced Software Options from NVRAM to keyvault

Convention:   
          -aN         N specifies the adapter number for the command.
          -a0,1,2     Specifies the command is for adapters 0, 1, and 2. More than one adapter can be selected.
          -aALL       Specifies the command is for all adapters.
            DeactivateTrialKey   
          ----------------

Syntax: 
    megacli elf deactivatetrialkey an|a0,1,2|aall

Description: 
        Deactivates the trial key

Convention:   
          -aN         N specifies the adapter number for the command.
          -a0,1,2     Specifies the command is for adapters 0, 1, and 2. More than one adapter can be selected.
          -aALL       Specifies the command is for all adapters.
            ReHostInfo   
          ----------------

Syntax: 
    megacli elf rehostinfo an|a0,1,2|aall

Description: 
        Displays the Re-Host information and if Re-Hosting is necessary then it will also displays the Controller and KeyVault serial numbers

Convention:   
          -aN         N specifies the adapter number for the command.
          -a0,1,2     Specifies the command is for adapters 0, 1, and 2. More than one adapter can be selected.
          -aALL       Specifies the command is for all adapters.
            ReHostComplete   
          ----------------

Syntax: 
    megacli elf rehostcomplete an|a0,1,2|aall

Description: 
        This notifies the Controller that Re-Host is being done

Convention:   
          -aN         N specifies the adapter number for the command.
          -a0,1,2     Specifies the command is for adapters 0, 1, and 2. More than one adapter can be selected.
          -aALL       Specifies the command is for all adapters.
=============================================================================
ENCINFO
            EncInfo
            -------

Syntax: 
    megacli encinfo an|a0,1,2|aall

Description: 
        Command displays information of enclosure's connected to the selected adapter(s).

Convention:   
          -aN         N specifies the adapter number for the command.
          -a0,1,2     Specifies the command is for adapters 0, 1, and 2. More than one adapter can be selected.
          -aALL       Specifies the command is for all adapters.
=============================================================================
ENCSTATUS
            EncStatus
            ----------

Syntax: 
    megacli encstatus an|a0,1,2|aall

Description: 
        Command displays status of the enclosure connected to the selected adapter(s).

Convention:   
          -aN         N specifies the adapter number for the command.
          -a0,1,2     Specifies the command is for adapters 0, 1, and 2. More than one adapter can be selected.
          -aALL       Specifies the command is for all adapters.
=============================================================================
FWTERMLOG
            FwTermLog
            ---------

Syntax: 
    megacli fwtermlog bbuoff|bbuofftemp|bbuon|bbuget|dsply|clear an|a0,1,2|aall

Description: 
        Sets BBU terminal logging options, following are the settings to select on a single adapter, multiple adapters, or all adapters: 
        The possible parameters are:
        Bbuoff: Turns off the BBU for firmware terminal logging. To turn off the BBU for logging, shut down system or turn off power to the system after running the command. 
        BbuoffTemp: Temporarily turns off the BBU for TTY (firmware terminal) logging. The battery will be turned on at the next reboot. 
        Bbuon: Turns on the BBU for TTY (firmware terminal) logging.
        BbuGet: Displays the current BBU settings for TTY logging.
        Dsply: Displays the TTY log (firmware terminal log) entries with details on the given adapters. The information shown consists of the total number of entries available at a firmware side. 
        Clear: Clears the TTY log.

Convention:   
          -aN         N specifies the adapter number for the command.
          -a0,1,2     Specifies the command is for adapters 0, 1, and 2. You can 
                      select two or more adapters in this manner.
          -aALL       Specifies the command is for all adapters.
=============================================================================
GETBBTENTRIES
            GetBbtEntries
            ------

Syntax: 
    megacli getbbtentries lx|l0,1,2|lall an|a0,1,2|aall

Description: 
        Command displays information about the Bad Block Entries of virtual disk(s) on the selected adapter(s).

Convention:   
          -aN         N specifies the adapter number for the command.
          -a0,1,2     Specifies the command is for adapters 0, 1, and 2. More than one adapter can be selected.
          -aALL       Specifies the command is for all adapters.
=============================================================================
GETKEYID
            GetKeyID
            --------

Syntax: 
    megacli getkeyid [physdrv "[e0:s0]] an

Description: 
        Gets the security key Id of specified physical disk drive on given adapter.

Convention:   
          -aN         N specifies the adapter number for the command.
          -PhysDrv[E0:S0,E1:S1....]  List of physical drives, E specifies enclosure 
                     id and S specifies Slot number of physical drive.  
=============================================================================
GETLDEXPANSIONINFO
            getLdExpansionInfo
            ------

Syntax: 
    megacli getldexpansioninfo lx|l0,1,2|lall an|a0,1,2|aall 

Description: 
        Command displays information on how much this particular VD can grow in size. The output displays Size available to grow within Array and Size available to grow within Disks that belong to the Array.

Convention:   
          -lN         N specifies the virtual/logical drive number for the command.
          -l0,1,2     Specifies the command is for virtual/logical drive number 0, 1, and 2. More than one virtual/logical driver number can be selected.
          -lALL       Specifies the command is for all virtual/logical drive.
          -aN         N specifies the adapter number for the command.
          -a0,1,2     Specifies the command is for adapters 0, 1, and 2. More than one adapter can be selected.
          -aALL       Specifies the command is for all adapters.
=============================================================================
GETPRESERVEDCACHELIST
            GetPreservedCacheList    
            ---------------------

Syntax: 
    megacli getpreservedcachelist an|a0,1,2|aall 

Description: 
        Command displays list of vd that have pinned cache.

Convention:   
          -aN         N specifies the adapter number for the command.
          -a0,1,2     Specifies the command is for adapters 0, 1, and 2. More than one adapter can be selected.
          -aALL       Specifies the command is for all adapters.
=============================================================================
HELP|-H|?
Invalid input at or near token     HELP|-H|?
Use -help to know command name
=============================================================================
LDBBMCLR
            LDBBMClr
            --------

Syntax: 
    megacli ldbbmclr lx|l0,1,2,...|lall an|a0,1,2|aall

Description: 
        Command clears the LDBBM table entries for the logical drive(s) on the given adapter(s).

Convention:   
          -aN         N specifies the adapter number for the command.
          -a0,1,2     Specifies the command is for adapters 0, 1, and 2. More than one adapter can be selected.
          -aALL       Specifies the command is for all adapters.
=============================================================================
LDBI
            LDBI
            ----

Syntax: 
    megacli ldbi enbl|dsbl|getsetting|abort|suspend|resume|showprog|progdsply lx|l0,1,2|lall an|a0,1,2|aall

Description: 
        Command manages background initialization options. Single, multiple or all adapters can be selected.
        The possible parameters are:
        Enbl, Dsbl: Enables or disables the background initialization on the selected adapter(s).
        Suspend: Suspend an ongoing background initialization. 
        Resume: Resume a Suspend background initialization.
        ProgDsply: Displays an ongoing background initialization in a loop. This function completes only when all background initialization processes complete or you press a key to exit. 
        ShowProg: Displays the current progress value.
        GetSetting: Displays current background initialization setting (Enabled or Disabled).

Convention:   
          -aN         N specifies the adapter number for the command.
          -a0,1,2     Specifies the command is for adapters 0, 1, and 2. More than one adapter can be selected.
          -aALL       Specifies the command is for all adapters.
=============================================================================
LDCC
            LDCC
            ----

Syntax: 
    megacli ldcc {start [force]}|abort|suspend|resume|showprog|progdsply lx|l0,1,2|lall an|a0,1,2|aall

Description: 
        Command performs Check consistence operation on given virtual disk.
        The possible parameters are:
        Start: Starts a CC on the virtual disk(s), then displays the progress (optional) and time remaining.
        Suspend: Suspend an ongoing CC on the virtual disk(s). 
        Resume: Resume a Suspend CC on the virtual disk(s). 
        Abort: Aborts an ongoing CC on the virtual disk(s). 
        ShowProg: Displays a snapshot of an ongoing CC. 
        ProgDsply: Displays ongoing CC progress. The progress displays until at least one CC is completed or a key is pressed.

Convention:   
          -aN         N specifies the adapter number for the command.
          -a0,1,2     Specifies the command is for adapters 0, 1, and 2. More than one adapter can be selected.
          -aALL       Specifies the command is for all adapters.
=============================================================================
LDEXPANSION
            LDExpansion
            ------

Syntax: 
    megacli ldexpansion pn [dontexpandarray] lx|l0,1,2|lall an|a0,1,2|aall 

Description: 
        This command will expands the VD by N percentage if space is available. The space available for expansion for the VD is given by command  -getLdExpansionInfo.
        Option -dontExpandArray needs to be given if increase in Array size is not required (i.e. VD will not grow using Size available to grow within Disks that belong to the Array)

Convention:   
          -lN         N specifies the virtual/logical drive number for the command.
          -l0,1,2     Specifies the command is for virtual/logical drive number 0, 1, and 2. More than one virtual/logical driver number can be selected.
          -lALL       Specifies the command is for all virtual/logical drive.
          -aN         N specifies the adapter number for the command.
          -a0,1,2     Specifies the command is for adapters 0, 1, and 2. More than one adapter can be selected.
          -aALL       Specifies the command is for all adapters.
=============================================================================
LDGETNUM
            LDGetNum
            --------

Syntax: 
    megacli ldgetnum an|a0,1,2|aall

Description: 
        Displays the number of virtual disks attached to the adapter. The return value is the number of virtual disks.

Convention:   
          -aN         N specifies the adapter number for the command.
          -a0,1,2     Specifies the command is for adapters 0, 1, and 2. More than one adapter can be selected.
          -aALL       Specifies the command is for all adapters.
=============================================================================
LDGETPROP
            LDGetProp 
            ---------

Syntax: 
    megacli ldgetprop  cache | access | name | dskcache | pspolicy | consistency  lx|l0,1,2|lall  
                -aN|-a0,1,2|-aALL

Description: 
        Displays the cache and access policies of the virtual disk(s)
        The possible parameters are:
        Cache: Cached, Direct: Displays cache policy.
        WT (Write through), WB (Write back): Selects write policy.
        NORA (No read ahead), RA (Read ahead), ADRA (Adaptive read ahead): Selects read policy.
        Access: -RW, -RO, Blocked: Displays access policy.
        DskCache: Displays physical disk cache policy.
        PSPolicy: Displays the default & current power savings policy of the virtual disk.

Convention:   
        Consistency: Displays LD Consistency State .
          -aN         N specifies the adapter number for the command.
          -a0,1,2     Specifies the command is for adapters 0, 1, and 2. More than one adapter can be selected.
          -aALL       Specifies the command is for all adapters.
=============================================================================
LDINFO
            LDInfo
            ------

Syntax: 
    megacli ldinfo lx|l0,1,2|lall an|a0,1,2|aall

Description: 
        Command displays information about the virtual disk(s) on the selected adapter(s). This information includes the name, RAID level, RAID level qualifier, size in megabytes, state, strip size, number of drives, span depth, cache policy, access policy, and ongoing activity progress, if any, including initialization, background initialization, consistency check, and reconstruction.

Convention:   
          -aN         N specifies the adapter number for the command.
          -a0,1,2     Specifies the command is for adapters 0, 1, and 2. More than one adapter can be selected.
          -aALL       Specifies the command is for all adapters.
=============================================================================
LDINIT
            LDInit
            ------

Syntax: 
    megacli ldinit {start [full]}|abort|showprog|progdsply lx|l0,1,2|lall an|a0,1,2|aall

Description: 
        Command performs initialization operation on given virtual disk.
        The possible parameters are:
        Start: Starts the initialization (writing 0s) on the virtual disk(s) and displays the progress (this is optional). The fast initialization option initializes the first and last 8 Mbyte areas on the virtual disk. The full option allows you to initialize the entire virtual disk. 
        Abort: Aborts the ongoing initialization on the LD(s).
        ShowProg: Displays the snapshot of the ongoing initialization, if any.
        ProgDsply: Displays the progress of the ongoing initialization. The routine continues to display the progress until at least one initialization is completed or a key is pressed.

Convention:   
          -aN         N specifies the adapter number for the command.
          -a0,1,2     Specifies the command is for adapters 0, 1, and 2. More than one adapter can be selected.
          -aALL       Specifies the command is for all adapters.
=============================================================================
LDJOINMIRROR
            LDJoinMirror
            ------

Syntax: 
    megacli ldjoinmirror datasrc <val>[force] lx|l0,1,2,...|lall an|a0,1,2|aall

Description: 
        command joins the VD with its mirror.

Convention:   
          -DataSrc <val>        if the val is 0, then data will be copied from existing VD to drives.if the val is 1 then data will be copied from drives to VD
          -force        This option will force the copying of data from drives to VD otherwise the CLI will give a warning that copying data from drives to VD will result in data corruption and quit.
          -aN         N specifies the adapter number for the command.
          -a0,1,2     Specifies the command is for adapters 0, 1, and 2. More than one adapter can be selected.
          -aALL       Specifies the command is for all adapters.
=============================================================================
LDMAKESECURE
            LDMakeSecure
            ------

Syntax: 
    megacli ldmakesecure lx|l0,1,2|lall an|a0,1,2|aall

Description: 
        This operation will secure all the virtual drives that are a part of drive group.

Convention:   
          -aN         N specifies the adapter number for the command.
          -a0,1,2     Specifies the command is for adapters 0, 1, and 2. More than one adapter can be selected.
          -aALL       Specifies the command is for all adapters.
=============================================================================
LDPDINFO
            LdPdInfo
            --------

Syntax: 
    megacli ldpdinfo an|a0,1,2|aall

Description: 
        Command displays information about the present virtual disk(s) and physical disk drive(s) on the selected adapter(s). Information including the number of virtual disks, the RAID level of the virtual disks, and physical drive size information, which includes raw size, coerced size, uncoerced size, and the SAS address.

Convention:   
          -aN         N specifies the adapter number for the command.
          -a0,1,2     Specifies the command is for adapters 0, 1, and 2. More than one adapter can be selected.
          -aALL       Specifies the command is for all adapters.
=============================================================================
LDRECON
            LDRecon
            -------

Syntax: 
    megacli ldrecon {start rx [{add | rmv} physdrv "[e0:s0,...]"]}|showprog|progdsply lx an

Description: 
        Command controls and manages virtual disk reconstruction. The following are the virtual disk reconstruction settings you can select on a single adapter:
        The possible parameters are:
        Start: Starts a reconstruction of the selected virtual disk to a new RAID level.
        -   Add: Adds listed physical disks to the virtual disk and starts reconstruction on the selected virtual disk.
        -   Rmv: Removes one physical disk from the existing virtual disks and starts a reconstruction.
        ShowProg: Displays a snapshot of the ongoing reconstruction process. 
        R0|-R1|-R5: Changes the RAID level of the virtual disk when you start reconstruction. You may need to add or remove a physical drive to make this possible. 
        ProgDsply: Allows you to view the ongoing reconstruction. The routine continues to display progress until at least one reconstruction is completed or a key is pressed.

Convention:   
          -aN         N specifies the adapter number for the command.
          -a0,1,2     Specifies the command is for adapters 0, 1, and 2. More than one adapter can be selected.
          -aALL       Specifies the command is for all adapters.
          -PhysDrv[E0:S0,E1:S1....]  List of physical drives, E specifies enclosure 
                     id and S specifies Slot number of physical drive.  
=============================================================================
LDSETPOWERPOLICY
            LdSetPowerPolicy   
          ----------------

Syntax: 
    megacli ldsetpowerpolicy default| automatic| none| maximum| maximumwithoutcaching
        -Lx|-L0,1,2|-Lall -aN|-a0,1,2|-aALL 

Description: 
        Sets the power saving level on the virtual disk.

Convention:   
          -Lx         x specifies the LD number for the command and the LD has to be a repository.
          -aN         N specifies the adapter number for the command.
          -a0,1,2     Specifies the command is for adapters 0, 1, and 2. More than one adapter can be selected.
          -aALL       Specifies the command is for all adapters.
=============================================================================
LDSETPROP
            LDSetProp 
            ---------

Syntax: 
    megacli ldsetprop  {name ldnamestring} | rw|ro|blocked|removeblocked | wt|wb|ra|nora|adra | dsblpi | cached|direct | endskcache|disdskcache | cachedbadbbu|nocachedbadbbu lx|l0,1,2|lall an|a0,1,2|aall

Description: 
        Command to change virtual disk properties on specified controller.
        The possible parameters are:
        WT (Write through), WB (Write back): Selects write policy.
        NORA (No read ahead), RA (Read ahead), ADRA (Adaptive read ahead): Selects read policy.
        Cached/Direct: Selects cache policy. 
        CachedBadBBU|NoCachedBadBBU: Specifies whether to use write cache when the BBU is bad.
        RW, -RO, Blocked: Selects access policy. 
        EnDskCache: Enables disk cache. 
        DisDskCache: Disables disk cache.

Convention:   
          -aN         N specifies the adapter number for the command.
          -a0,1,2     Specifies the command is for adapters 0, 1, and 2. More than one adapter can be selected.
          -aALL       Specifies the command is for all adapters.
=============================================================================
LDVIEWMIRROR
            LDViewMirror
            ------

Syntax: 
    megacli ldviewmirror lx|l0,1,2|lall an|a0,1,2|aall

Description: 
        command displays the information about the mirror assocaited with the VD.

Convention:   
          -aN         N specifies the adapter number for the command.
          -a0,1,2     Specifies the command is for adapters 0, 1, and 2. More than one adapter can be selected.
          -aALL       Specifies the command is for all adapters.
=============================================================================
PDCLEAR
            PDClear
            -------

Syntax: 
    megacli pdclear start|stop|showprog |progdsply physdrv "[e0:s0,e1:s1,...]" an|a0,1,2|aall

Description: 
        Manages physical disk initialization or displays initialization progress on a single adapter, multiple adapters, or all adapters:
        The possible parameters are:
        Start: Starts initialization on the selected physical disk drive(s).
        Stop: Stops an ongoing initialization on the selected physical disk drive(s). 
        ShowProg: Displays the current progress percentage and time remaining for the initialization. This option is useful for running the application through scripts. ProgDsply: Displays the ongoing clear progress. The routine continues to display the initialization progress until at least one initialization is completed or a key is pressed.

Convention:   
          -aN         N specifies the adapter number for the command.
          -a0,1,2     Specifies the command is for adapters 0, 1, and 2. More than one adapter can be selected.
          -aALL       Specifies the command is for all adapters.
          -PhysDrv[E0:S0,E1:S1....]  List of physical drives, E specifies enclosure 
                     id and S specifies Slot number of physical drive.  
=============================================================================
PDCPYBK
            PDCpyBk
            --------

Syntax: 
    megacli pdcpybk start physdrv "[e0:s0,e1:s1] an|a0,1,2|aall

Syntax: 
    megacli pdcpybk stop|suspend|resume|showprog|progdsply physdrv "[e0:s0] an|a0,1,2|aall

Description: 
        Command performs the copy back operation on given physical drive.
        The possible parameters are:
        Start:  Initializes the copy back operation on physical drive.
        Suspend: Suspend the copy back operation on physical drive.
        Resume: Resume the copy back operation on physical drive.
        Stop: Stops the copy back operation on physical drive.

Convention:   
          -aN         N specifies the adapter number for the command.
          -a0,1,2     Specifies the command is for adapters 0, 1, and 2. More than one adapter can be selected.
          -aALL       Specifies the command is for all adapters.
          -PhysDrv[E0:S0,E1:S1....]  List of physical drives, E specifies enclosure 
           E0:S0 - Specifies the source Physical drive 
           E1:S1 - Specifies the Destination Physical drive 
                     id and S specifies Slot number of physical drive.  
=============================================================================
PDFWDOWNLOAD
            PdFwDownload
            ------------

Syntax: 
    megacli pdfwdownload [offline] [forceactivate] {[satabridge] physdrv [0:1] }|{encdevid[devid1]} f <filename> an|a0,1,2|aall 

Description: 
        Flashes the firmware from the file specified at command line. Firmware files used to flash the physical drive or Enclosure can be of any format. Command assumes that user is providing valid firmware image and flashes the same. Its up to the physical drive or Enclosure to do error checking. 
        -forceactivate option should be used only if target device is an enclosure.
        -offline option should be used only if target device is an enclosure firmware and if the enclosure type is Shea or MileHigh. The firmware file extension should be .esm if this option is used. This option forces the application to flash enclosure firmware using offline method 
         and is supported only in DOS version of the command tool. 
        -SataBridge option must be used if target device is Alta. 

Convention:   
          -aN         N specifies the adapter number for the command.
          -a0,1,2     Specifies the command is for adapters 0, 1, and 2. More than one adapter can be selected.
          -aALL       Specifies the command is for all adapters.
          -PhysDrv[E0:S0]  Physical drive, E specifies enclosure 
                     id and S specifies Slot number of physical drive.  
            EncdevId[devId1] deviceId of the enclosure.  
=============================================================================
PDGETMISSING
            PdGetMissing
            ------------

Syntax: 
    megacli pdgetmissing an|a0,1,2|aall

Description: 
        Command displays all the physical disk drive(s) in missing status. 

Convention:   
          -aN         N specifies the adapter number for the command.
          -a0,1,2     Specifies the command is for adapters 0, 1, and 2. More than one adapter can be selected.
          -aALL       Specifies the command is for all adapters.
=============================================================================
PDGETNUM
            PDGetNum
            --------

Syntax: 
    megacli pdgetnum an|a0,1,2|aall

Description: 
        Displays the total number of physical disk drives attached to an adapter. Drives can be attached directly or through enclosures. The return value is the number of physical disk drives.

Convention:   
          -aN         N specifies the adapter number for the command.
          -a0,1,2     Specifies the command is for adapters 0, 1, and 2. You can 
                      select two or more adapters in this manner.
          -aALL       Specifies the command is for all adapters.
=============================================================================
PDHSP
            PDHSP
            ----------

Syntax: 
    megacli pdhsp {set [dedicated [arrayn|array0,1,2...]"] "[enclaffinity] 
        [-nonRevertible]} |-Rmv -PhysDrv[E0:S0,E1:S1,...] -aN|-a0,1,2|-aALL

Description: 
        Changes the physical disk drive state (as it relates to hot spares) and associates the drive to an enclosure and virtual disk on a single adapter, multiple adapters, or all adapters.
        The possible parameters are:
        Set: Changes the physical disk drive state to dedicated hot spare for the enclosure. 
        Rmv: Changes the physical drive state to ready (removes the hot spare).
        EnclAffinity: Associates the hot spare to a selected enclosure.
        Array0: Dedicates the hot spare to a specific virtual disk.

Convention:   
          -aN         N specifies the adapter number for the command.
          -a0,1,2     Specifies the command is for adapters 0, 1, and 2. More than one adapter can be selected.
          -aALL       Specifies the command is for all adapters.
          -PhysDrv[E0:S0,E1:S1....]  List of physical drives, E specifies enclosure 
                     id and S specifies Slot number of physical drive.  
=============================================================================
PDINFO
            pdInfo
            ------

Syntax: 
    megacli pdinfo physdrv "[e0:s0,e1:s1,...]" an|a0,1,2|aall

Description: 
        Provides information of physical disk drives connected to the enclosure and adapter slot. This includes information such as the enclosure number, slot number, device ID, sequence number, drive type, size (if a physical drive), foreign state, firmware state, and inquiry data.  For SAS devices, this includes additional information such as the SAS address of the drive. For SAS expanders, this includes additional information such as the number of devices connected to the expander.

Convention:   
          -aN         N specifies the adapter number for the command.
          -a0,1,2     Specifies the command is for adapters 0, 1, and 2. You can 
                      select two or more adapters in this manner.
          -aALL       Specifies the command is for all adapters.
          -PhysDrv[E0:S0,E1:S1....]  List of physical drives, E specifies enclosure 
                     id and S specifies Slot number of physical drive.  
=============================================================================
PDINSTANTSECUREERASE
            PDInstantSecureErase
            -------------

Syntax: 
    megacli  pdinstantsecureerase physdrv "[e0:s0,e1:s1,...]" | [force] an|a0,1,2|aall

Description: 
        Command erases specified drives security configuration, so that it can be used on given controller. This operation removes current data available on drive.   

Convention:   
          -aN         N specifies the adapter number for the command.
          -a0,1,2     Specifies the command is for adapters 0, 1, and 2. More than one adapter can be selected.
          -aALL       Specifies the command is for all adapters.
          -PhysDrv[E0:S0,E1:S1....]  List of physical drives, E specifies enclosure 
                     id and S specifies Slot number of physical drive.  
=============================================================================
PDLIST
            PDList
            ------

Syntax: 
    megacli pdlist an|a0,1,2|aall

Description: 
        Displays information about all physical disk drives and other devices connected to the selected adapter(s). This includes information such as the drive type, size (if a physical disk drive), serial number, and firmware version of the device. For SAS devices, this includes additional information such as the SAS address of the device. For SAS expanders, this includes additional information such as the number of drives connected to the expander.

Convention:   
          -aN         N specifies the adapter number for the command.
          -a0,1,2     Specifies the command is for adapters 0, 1, and 2. You can 
                      select two or more adapters in this manner.
          -aALL       Specifies the command is for all adapters.
=============================================================================
PDLOCATE
            PdLocate
            --------

Syntax: 
    megacli pdlocate {[start] | stop } physdrv "[e0:s0,e1:s1,...]" an|a0,1,2|aall

Description: 
        Locates the physical disk drive(s) for the selected adapter(s) and activates the physical disk activity LED.
        The possible parameters are:
        Start:  Activates LED on the selected physical disk drive(s).
        Stop: Stops active LED on the selected physical disk drive(s). 

Convention:   
          -aN         N specifies the adapter number for the command.
          -a0,1,2     Specifies the command is for adapters 0, 1, and 2. More than one adapter can be selected.
          -aALL       Specifies the command is for all adapters.
          -PhysDrv[E0:S0,E1:S1....]  List of physical drives, E specifies enclosure 
                     id and S specifies Slot number of physical drive.  
=============================================================================
PDMAKEGOOD
            PDMakeGood
            ----------

Syntax: 
    megacli pdmakegood physdrv "[e0:s0,e1:s1,...]" | [force] an|a0,1,2|aall

Description: 
        Command changes the physical disk drive state to Ready.

Convention:   
          -aN         N specifies the adapter number for the command.
          -a0,1,2     Specifies the command is for adapters 0, 1, and 2. More than one adapter can be selected.
          -aALL       Specifies the command is for all adapters.
          -PhysDrv[E0:S0,E1:S1....]  List of physical drives, E specifies enclosure 
                     id and S specifies Slot number of physical drive.  
        Force:  This option will force PD state to be Unconfigured Good and is applicable only if the previous state is SYSTEM.
=============================================================================
PDMAKEJBOD
            PDMakeJBOD
            ----------

Syntax: 
    megacli pdmakejbod physdrv "[e0:s0,e1:s1,...]" an|a0,1,2|aall

Description: 
        Command changes the physical disk drive state to JBOD.

Convention:   
          -aN         N specifies the adapter number for the command.
          -a0,1,2     Specifies the command is for adapters 0, 1, and 2. More than one adapter can be selected.
          -aALL       Specifies the command is for all adapters.
          -PhysDrv[E0:S0,E1:S1....]  List of physical drives, E specifies enclosure 
                     id and S specifies Slot number of physical drive.  
=============================================================================
PDMARKMISSING
            PdMarkMissing
            -------------

Syntax: 
    megacli pdmarkmissing physdrv "[e0:s0,e1:s1,...]" an|a0,1,2|aall

Description: 
        Command Marks the configured physical disk drive as missing for the selected adapter.

Convention:   
          -aN         N specifies the adapter number for the command.
          -a0,1,2     Specifies the command is for adapters 0, 1, and 2. More than one adapter can be selected.
          -aALL       Specifies the command is for all adapters.
          -PhysDrv[E0:S0,E1:S1....]  List of physical drives, E specifies enclosure 
                     id and S specifies Slot number of physical drive.  
=============================================================================
PDOFFLINE
            PDOffline
            ----------

Syntax: 
    megacli pdoffline physdrv "[e0:s0,e1:s1,...]" an|a0,1,2|aall

Description: 
        Command changes the physical disk drive state to Offline.

Convention:   
          -aN         N specifies the adapter number for the command.
          -a0,1,2     Specifies the command is for adapters 0, 1, and 2. You can 
                      select two or more adapters in this manner.
          -aALL       Specifies the command is for all adapters.
          -PhysDrv[E0:S0,E1:S1....]  List of physical drives, E specifies enclosure 
                     id and S specifies Slot number of physical drive.  
=============================================================================
PDONLINE
            PDOnline  
            --------

Syntax: 
    megacli pdonline  physdrv "[e0:s0,e1:s1,...]" an|a0,1,2|aall

Description: 
        Command changes the physical drive state to Online.

Convention:   
          -aN         N specifies the adapter number for the command.
          -a0,1,2     Specifies the command is for adapters 0, 1, and 2. You can 
                      select two or more adapters in this manner.
          -aALL       Specifies the command is for all adapters.
          -PhysDrv[E0:S0,E1:S1....]  List of physical drives, E specifies enclosure 
                     id and S specifies Slot number of physical drive.  
=============================================================================
PDPRPRMV
            PdPrpRmv
            --------

Syntax: 
    megacli pdprprmv [undo] physdrv "[e0:s0] an|a0,1,2|aall

Description: 
        Command prepares unconfigured physical drive(s) for removal. The firmware will spin down this drive. The drive state is set to unaffiliated, which marks it as offline even though it is not a part of configuration. 
        The possible parameters is:
        Undo: undoes this operation. If you select undo, the firmware marks this physical disk as unconfigured good.

Convention:   
          -aN         N specifies the adapter number for the command.
          -a0,1,2     Specifies the command is for adapters 0, 1, and 2. More than one adapter can be selected.
          -aALL       Specifies the command is for all adapters.
          -PhysDrv[E0:S0,E1:S1....]  List of physical drives, E specifies enclosure 
                     id and S specifies Slot number of physical drive.  
=============================================================================
PDRBLD
            PDRbld
            ------

Syntax: 
    megacli pdrbld start|stop|suspend|resume|showprog |progdsply physdrv "[e0:s0,e1:s1,...]" an|a0,1,2|aall

Description: 
        Manages a physical disk rebuild or displays the rebuild progress on a single adapter, multiple adapters, or all adapters. 
        The possible parameters are:
        Start: Starts a rebuild on the selected physical drive(s) and displays the rebuild progress (optional).
        Suspend: Suspend a rebuild on the selected physical drive(s).
        Resume: Resume a rebuild on the selected physical drive(s).
        Stop: Stops an ongoing rebuild on the selected physical drive(s). 
        ShowProg: Displays the current progress percentage and time remaining for the rebuild. This option is useful for running the application through scripts. 
        ProgDsply: Displays the ongoing rebuild progress. This routine displays the rebuild progress until at least one initialization is completed or a key is pressed.

Convention:   
          -aN         N specifies the adapter number for the command.
          -a0,1,2     Specifies the command is for adapters 0, 1, and 2. More than one adapter can be selected.
          -aALL       Specifies the command is for all adapters.
          -PhysDrv[E0:S0,E1:S1....]  List of physical drives, E specifies enclosure 
                     id and S specifies Slot number of physical drive.  
        Note: Physical disk must meet the size requirements before it can be rebuilt, and it must be part of an array:
=============================================================================
PDREPLACEMISSING
            PdReplaceMissing
            ----------------

Syntax: 
    megacli pdreplacemissing physdrv "[e0:s0] array A rob B an

Description: 
        Replaces the configured physical disk drives that are identified as missing and then starts an automatic rebuild.

Convention:   
          -aN         N specifies the adapter number for the command.
          -a0,1,2     Specifies the command is for adapters 0, 1, and 2. More than one adapter can be selected.
          -aALL       Specifies the command is for all adapters.
        Note: Specified array Index/row must be a missing drive. Automatic rebuild will start.
          -PhysDrv[E0:S0,E1:S1....]  List of physical drives, E specifies enclosure 
                     id and S specifies Slot number of physical drive.  
=============================================================================
PERFMON
            Perfmon
               ----------

Syntax: 
    megacli perfmon {start interval <val>} | {stop} | {getresults f <filename>} an 

Description: 
        This command show the performance data.
interval: Interval is perfomance data capture time in minutes. 
=============================================================================
PHYERRORCOUNTERS
            PhyErrorCounters    
            ----------------

Syntax: 
    megacli phyerrorcounters an|a0,1,2|aall   

Description: 
        Command gets information about PHY's error logs for the PHYs.

Convention:   
          -aN         N specifies the adapter number for the command.
          -a0,1,2     Specifies the command is for adapters 0, 1, and 2. More than one adapter can be selected.
          -aALL       Specifies the command is for all adapters.
=============================================================================
PHYINFO
            PhyInfo
            -------

Syntax: 
    megacli phyinfo phym an|a0,1,2|aall

Description: 
        Command displays PHY connection information for physical PHY M on the adapter(s).

Convention:   
          -aN         N specifies the adapter number for the command.
          -a0,1,2     Specifies the command is for adapters 0, 1, and 2. More than one adapter can be selected.
          -aALL       Specifies the command is for all adapters.
=============================================================================
PHYSETLINKSPEED
            PhySetLinkSpeed
            -------

Syntax: 
    megacli physetlinkspeed phym speed an|a0,1,2|aall

Description: 
        Command sets PHY link speed for physical PHY M on the adapter(s).
        Where speed can be 0-(No Limit), 1-(1.5GB/s), 2-(3GB/s), 4-(6GB/s).

Convention:   
          -aN         N specifies the adapter number for the command.
          -a0,1,2     Specifies the command is for adapters 0, 1, and 2. More than one adapter can be selected.
          -aALL       Specifies the command is for all adapters.
=============================================================================
SECUREERASE
            SecureErase
            -----------

Syntax: 
    megacli secureerase 
    Start[
        Simple|
        [Normal   [ |ErasePattern ErasePatternA|ErasePattern ErasePatternA ErasePattern ErasePatternB]]|
        [Thorough [ |ErasePattern ErasePatternA|ErasePattern ErasePatternA ErasePattern ErasePatternB]]]
    | Stop
    | ShowProg
    | ProgDsply 
    [-PhysDrv [E0:S0,E1:S1,...] | -Lx|-L0,1,2|-LALL] -aN|-a0,1,2|-aALL

Description: 
        Securely erases data on non-SEDs and unsecured VDs 
        The possible parameters are:
        Start: Starts Secure Erase on the selected physical drive(s) or virtual drive(s).
        Simple|Normal|Thorough:These are the erase types.
        ErasePattern:The pattern for erasing
        ErasePatternA|ErasePatternB:This is an 8-Bit binary pattern for erasing(Example:01001101)
        Stop: Stops the ongoing Secure Erase on the selected physical drive(s) or virtual drive(s). 
        ShowProg: Displays the snapshot of ongoing SecureErase.
        ProgDsply: Displays the ongoing SecureErase progress. This routine displays the SecureErase progress until at least one SecureErase is completed or a key is pressed.

Convention:   
          -aN         N specifies the adapter number for the command.
          -a0,1,2     Specifies the command is for adapters 0, 1, and 2. More than one adapter can be selected.
          -aALL       Specifies the command is for all adapters.
          -PhysDrv[E0:S0,E1:S1....]  List of physical drives, E specifies enclosure 
                     id and S specifies Slot number of physical drive.  
          -Lx         x specifies the LD number.
          -aN         N specifies the adapter number for the command.
          -a0,1,2     Specifies the command is for adapters 0, 1, and 2. More than one adapter can be selected.
          -aALL       Specifies the command is for all adapters.
=============================================================================
SETKEYID
            SetKeyID
            --------

Syntax: 
    megacli setkeyid keyid kkkkkkkkkkk an

Description: 
        Command sets the security key Id on given adapter.
        The parameters are:
        KeyID: Security key Id of given controller.

Convention:   
          -aN         N specifies the adapter number for the command.
=============================================================================
SHOWSUMMARY
            ShowSummary   
          ----------------

Syntax: 
    megacli showsummary [f filename] an

Description: 
        Displays the summary of all the important information about the controller

Convention:   
          -aN         N specifies the adapter number for the command.
=============================================================================
V
            Version 
            -------

Syntax: 
    megacli v

Description: 
        Command displays the version number of the MegaCLI utility.
=============================================================================
VERIFYSECURITYKEY
            VerifySecurityKey
            -----------------

Syntax: 
    megacli verifysecuritykey securitykey sssssssssss an

Description: 
        Command validates the given security key with the security key of given controller. 
        The parameters is:
        SecurityKey: Security key need to be verified. 

Convention:   
          -aN         N specifies the adapter number for the command.
=============================================================================
VERSION
            Version   
          ------------------

Syntax: 
    megacli version cli|ctrl|driver|pd an|a0,1,2|aall

Description: 
         Displays the version corresponding to tne option
Note: -Driver option is not supported for MegaCliKL application.
=============================================================================
XD ADDCDEV
            AddCdev command
            ---------------

Syntax: 
    megacli xd addcdev <devlist> | force

Description: 
          This command adds the given cache devices to the cache group.
              <devList>  List of devices seperated by ":" (without leading/trailing space/tab).
              -force     Force adding device with filesystem / MBR / swap / LVM2.
=============================================================================
XD ADDVD
            AddVd command
            -------------

Syntax: 
    megacli xd addvd <devlist>

Description: 
          This command adds the given virtual drives to the cache group.
              <devList>  List of devices seperated by ":" (without leading/trailing space/tab).
=============================================================================
XD APPLYACTIVATIONKEY
            ApplyActivationKey command
            ---------------------------

Syntax: 
    megacli xd applyactivationkey <key> in 

Description: 
          This command applies Activation Key a WarpDrive. 
              <key>     Activation key
              -iN       Applies the Activation key to the Nth WarpDrive. N is an index of a WD from 
                        the WD list(listed by "MegaCli64 XD -WarpDriveInfo -iALL" command).
=============================================================================
XD CDEVLIST
            CdevList command
            ----------------

Syntax: 
    megacli xd cdevlist | configured | unconfigured

Description: 
          This command lists configured and unconfigured cache devices.
          without any option this will list both configured and unconfigured devices.
          The information displayed are: Device Node, WWN, Capacity.
          The capacity of the device is displayed in terms of blocks.
              -configured    Lists only configured cache devices.
              -unconfigured  Lists only unconfigured cache devices.
=============================================================================
XD CONFIGINFO
            ConfigInfo command
            ------------------

Syntax: 
    megacli xd configinfo

Description: 
          This command displays information about XD driver.
=============================================================================
XD FETCHSAFEID
            FetchSafeId command
            --------------------

Syntax: 
    megacli xd fetchsafeid in|iall 

Description: 
          This command displays the Safe ID of a WarpDrive.
              -iN       Displays the SafeID of the Nth WarpDrive. N is an index of a WD from 
                        the WD list(listed by "MegaCli64 XD -WarpDriveInfo -iALL" command).
=============================================================================
XD ONLINEVD
            OnlineVd command
            -----------------

Syntax: 
    megacli xd onlinevd <devlist> 

Description: 
          This command reconfigures a VD which is in Ready for Online State.
=============================================================================
XD PERFSTATS
            PerfStats command
            -----------------

Syntax: 
    megacli xd perfstats

Description: 
          This command displays information about XD performance statistics.
=============================================================================
XD REMCDEV
            RemCdev command
            ---------------

Syntax: 
    megacli xd remcdev <devlist>

Description: 
          This command removes the given cache devices from the cache group.
              <devList>  List of devices seperated by ":" (without leading/trailing space/tab).
=============================================================================
XD REMVD
            RemVd command
            -------------

Syntax: 
    megacli xd remvd <devlist>

Description: 
          This command removes the given virtual drives from the cache group.
              <devList>  List of devices seperated by ":" (without leading/trailing space/tab).
=============================================================================
XD VDLIST
            VdList command
            --------------

Syntax: 
    megacli xd vdlist | configured | unconfigured

Description: 
          This command lists configured and unconfigured virtual drives,
          without any option this will list both configured and unconfigured devices.
          The information displayed are: Device Node, WWN, Capacity.
          The capacity of the device is displayed in terms of blocks.
              -configured    Lists only configured virtual drives.
              -unconfigured  Lists only unconfigured virtual drives.
=============================================================================
XD WARPDRIVEINFO
            WarpDriveInfo command
            ----------------------

Syntax: 
    megacli xd warpdriveinfo in|iall 

Description: 
          This command displays the list of WarpDrives connected to the system. 
      The information displayed includes controller ID and other information 
      about the WarpDrive controller. The index of a particular WarpDrive in the list 
      is needed to be used in the PFK related XD commands, i.e., 
      FetchSafeId and ApplyActivationKey. 
              -iN   Lists info about only Nth Warpdrive. N is an index of a WD from 
                        the WD list(listed by iALL).
              -iALL Lists info about all WarpDrives in the system.
proper bash history logging
posted on 2016-09-14 23:32

By appending these to your .bashrc:

HISTTIMEFORMAT="%s "
PROMPT_COMMAND="${PROMPT_COMMAND:+$PROMPT_COMMAND ; }"'echo $$ $USER "$(history 1)" >> ~/.bash_history2'

you get a proper history looking like that from all shells connected to a server for each individual user:

root@fahi:~# cat .bash_history2
2786 root    91  1473887187 echo test
2786 root    92  1473887262 l
2786 root    93  1473887267 rm .bash_eternal_history 
2806 root    98  1473887148 tail -f .bash_eternal_history 
2806 root    99  1473888769 cat .bash_history2
2806 root   100  1473888788 lsblk
2821 root    98  1473887148 tail -f .bash_eternal_history 
2821 root    99  1473888794 history 
2821 root   100  1473888809 cat .bash_history2
2835 root   102  1473888809 cat .bash_history2

From the first look it looks good so far, but I fear there is some testing due to make sure there are no bad edge cases. One that I've found so far, was the last command gets repeated on login, maybe, and also when ctrl-c'ing commands. But this could have been the cause due to different shells being active with and without the prompt_command.

More alternatives can be found here.

xxd vs hexdump vs od for examining disk dumps from a VMware image
posted on 2016-09-14 21:49

the problem

The problem at hand was, VEEAM backup could not be restored. Neither could the backup be restored, nor could the the backup be opened in from the GUI. So how to verify wether something could be rescued from there?

getting the disk image out of the VEEAM backup

VEEAM lets you extract single images from the complete backup with its Extract.exe utility. Simply locate the executable on disk and start it without parameters. Then you are prompted for the full path to the complete .vbk backup file, afterward select the image you want to extract.

first look at the disk dump

After copying the folder with all the extracted contents, onto a linux box, the fun could start.

  • The VMware image is in the `diskname-###.vmdk' file.
  • .vmdk is the disk configuration file.
  • .nvram is the virtual machine's BIOS.
  • .vmx is the primary configuration file.
  • .vmxf is supplemental configuration.

examining the disk image

Easiest this is done through parted, showing once the size in sectors. This helps when using dd later and skipping over the first x sectors. Afterwards in bytes, for the offset in losetup, which will be easier than dd-skipping around..

Sectors:

root@workstation:/home/sjas/ftp# parted my_server-flat.vmdk u s p
Error: Can't have a partition outside the disk!
Ignore/Cancel? i                                                          
Error: Can't have a partition outside the disk!
Ignore/Cancel? i                                                          
Model:  (file)
Disk /home/sjas/ftp/my_server-flat.vmdk: 83869185s
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags: 

Number  Start     End        Size       Type     File system     Flags
 1      2048s     8390655s   8388608s   primary  linux-swap(v1)
 2      8390656s  83886079s  75495424s  primary                  boot

Bytes:

root@workstation:/home/sjas/ftp# parted my_server-flat.vmdk u b p
Error: Can't have a partition outside the disk!
Ignore/Cancel? i                                                          
Error: Can't have a partition outside the disk!
Ignore/Cancel? i                                                          
Model:  (file)
Disk /home/sjas/ftp/my_server-flat.vmdk: 42941022720B
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags: 

Number  Start        End           Size          Type     File system     Flags
 1      1048576B     4296015871B   4294967296B   primary  linux-swap(v1)
 2      4296015872B  42949672959B  38653657088B  primary                  boot

setting up the loop device, so the filesystem from within the file could be read

losetup  # should show nothing, so the first loop device we will use will be loop0
losetup -f # can alternatively be used to find the first free loop device
losetup /dev/loop0 my_server-flat.vmdk

To have easier access to the second partition (so we can use dd without having to use the skip flag all the time), we will loop the second partition, too. Offset is passed by -o in sectors, see the parted output above:

losetup -o 8390656 /dev/loop1 /dev/loop0

Then losetup should look like this:

root@workstation:/home/sjas/ftp# losetup 
NAME       SIZELIMIT     OFFSET AUTOCLEAR RO BACK-FILE
/dev/loop0         0          0         0  0 /home/sjas/ftp/my_server-flat.vmdk
/dev/loop1         0 4296015872         0  0 /dev/loop0

Alternatively you can use losetup -a to show the currently used loop devices.

Once you are done with everything, the loop devices could be deleted via losetup -d /dev/loopX for each one in use.

Alternatively, kpartx can be used, too. It would create device mappings automatically when run like kpartx -av my_server-flat.vmdk. The next free loop device under /dev/loopX would be chosen, and its partition could then be found under loopXp1, loopXp2, etc. Afterwards it could be deleted via kpartx -d my_server-flat.vmdk. However I prefer doing it manually, as with broken partitions kpartx cannot work properly, of course.

examination

Via dd the blocks can be read directly from the loop device'd disk. hexdump, xxd or od will make visible what is actually on there.

Initially this post grew out of the will to document the differences between them, but grew to include how to use the loop device stuff, too.

First lets have a look at the MBR, which is on the first block / 512 bytes on the device

root@workstation:/home/sjas/ftp# dd if=/dev/loop0 bs=512 count=1 2>/dev/null | file -
/dev/stdin: DOS/MBR boot sector; GRand Unified Bootloader, stage1 version 0x3, boot drive 0x80, 1st sector stage2 0x2443e60, GRUB version 0.94

Now lets check wether a VBR is present on the second partition or not, which is not the cause:

root@workstation:/home/sjas/ftp# dd if=/dev/loop1 bs=512 count=1 2>/dev/null | file -
/dev/stdin: data

For illustration here are the three tools in action, showing the MBR of loop0. Lets have a look at the actual disk contents:

xxd:

root@workstation:/home/sjas/ftp# dd if=/dev/loop0 bs=512 count=1 2>/dev/null | xxd
0000000: eb48 9010 8ed0 bc00 b0b8 0000 8ed8 8ec0  .H..............
0000010: fbbe 007c bf00 06b9 0002 f3a4 ea21 0600  ...|.........!..
0000020: 00be be07 3804 750b 83c6 1081 fefe 0775  ....8.u........u
0000030: f3eb 16b4 02b0 01bb 007c b280 8a74 0302  .........|...t..
0000040: 8000 0080 603e 4402 0008 fa90 90f6 c280  ....`>D.........
0000050: 7502 b280 ea59 7c00 0031 c08e d88e d0bc  u....Y|..1......
0000060: 0020 fba0 407c 3cff 7402 88c2 52f6 c280  . ..@|<.t...R...
0000070: 7454 b441 bbaa 55cd 135a 5272 4981 fb55  tT.A..U..ZRrI..U
0000080: aa75 43a0 417c 84c0 7505 83e1 0174 3766  .uC.A|..u....t7f
0000090: 8b4c 10be 057c c644 ff01 668b 1e44 7cc7  .L...|.D..f..D|.
00000a0: 0410 00c7 4402 0100 6689 5c08 c744 0600  ....D...f.\..D..
00000b0: 7066 31c0 8944 0466 8944 0cb4 42cd 1372  pf1..D.f.D..B..r
00000c0: 05bb 0070 eb7d b408 cd13 730a f6c2 800f  ...p.}....s.....
00000d0: 84f0 00e9 8d00 be05 7cc6 44ff 0066 31c0  ........|.D..f1.
00000e0: 88f0 4066 8944 0431 d288 cac1 e202 88e8  ..@f.D.1........
00000f0: 88f4 4089 4408 31c0 88d0 c0e8 0266 8904  ..@.D.1......f..
0000100: 66a1 447c 6631 d266 f734 8854 0a66 31d2  f.D|f1.f.4.T.f1.
0000110: 66f7 7404 8854 0b89 440c 3b44 087d 3c8a  f.t..T..D.;D.}<.
0000120: 540d c0e2 068a 4c0a fec1 08d1 8a6c 0c5a  T.....L......l.Z
0000130: 8a74 0bbb 0070 8ec3 31db b801 02cd 1372  .t...p..1......r
0000140: 2a8c c38e 0648 7c60 1eb9 0001 8edb 31f6  *....H|`......1.
0000150: 31ff fcf3 a51f 61ff 2642 7cbe 7f7d e840  1.....a.&B|..}.@
0000160: 00eb 0ebe 847d e838 00eb 06be 8e7d e830  .....}.8.....}.0
0000170: 00be 937d e82a 00eb fe47 5255 4220 0047  ...}.*...GRUB .G
0000180: 656f 6d00 4861 7264 2044 6973 6b00 5265  eom.Hard Disk.Re
0000190: 6164 0020 4572 726f 7200 bb01 00b4 0ecd  ad. Error.......
00001a0: 10ac 3c00 75f4 c300 0000 0000 0000 0000  ..<.u...........
00001b0: 0000 0000 0000 0000 9b09 0b00 0000 0020  ............... 
00001c0: 2100 824b 810a 0008 0000 0000 8000 804b  !..K...........K
00001d0: 820a 83fe ffff 0008 8000 00f8 7f04 0000  ................
00001e0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00001f0: 0000 0000 0000 0000 0000 0000 0000 55aa  ..............U.

hexdump:

root@workstation:/home/sjas/ftp# dd if=/dev/loop0 bs=512 count=1 2>/dev/null | hexdump -vC
00000000  eb 48 90 10 8e d0 bc 00  b0 b8 00 00 8e d8 8e c0  |.H..............|
00000010  fb be 00 7c bf 00 06 b9  00 02 f3 a4 ea 21 06 00  |...|.........!..|
00000020  00 be be 07 38 04 75 0b  83 c6 10 81 fe fe 07 75  |....8.u........u|
00000030  f3 eb 16 b4 02 b0 01 bb  00 7c b2 80 8a 74 03 02  |.........|...t..|
00000040  80 00 00 80 60 3e 44 02  00 08 fa 90 90 f6 c2 80  |....`>D.........|
00000050  75 02 b2 80 ea 59 7c 00  00 31 c0 8e d8 8e d0 bc  |u....Y|..1......|
00000060  00 20 fb a0 40 7c 3c ff  74 02 88 c2 52 f6 c2 80  |. ..@|<.t...R...|
00000070  74 54 b4 41 bb aa 55 cd  13 5a 52 72 49 81 fb 55  |tT.A..U..ZRrI..U|
00000080  aa 75 43 a0 41 7c 84 c0  75 05 83 e1 01 74 37 66  |.uC.A|..u....t7f|
00000090  8b 4c 10 be 05 7c c6 44  ff 01 66 8b 1e 44 7c c7  |.L...|.D..f..D|.|
000000a0  04 10 00 c7 44 02 01 00  66 89 5c 08 c7 44 06 00  |....D...f.\..D..|
000000b0  70 66 31 c0 89 44 04 66  89 44 0c b4 42 cd 13 72  |pf1..D.f.D..B..r|
000000c0  05 bb 00 70 eb 7d b4 08  cd 13 73 0a f6 c2 80 0f  |...p.}....s.....|
000000d0  84 f0 00 e9 8d 00 be 05  7c c6 44 ff 00 66 31 c0  |........|.D..f1.|
000000e0  88 f0 40 66 89 44 04 31  d2 88 ca c1 e2 02 88 e8  |..@f.D.1........|
000000f0  88 f4 40 89 44 08 31 c0  88 d0 c0 e8 02 66 89 04  |..@.D.1......f..|
00000100  66 a1 44 7c 66 31 d2 66  f7 34 88 54 0a 66 31 d2  |f.D|f1.f.4.T.f1.|
00000110  66 f7 74 04 88 54 0b 89  44 0c 3b 44 08 7d 3c 8a  |f.t..T..D.;D.}<.|
00000120  54 0d c0 e2 06 8a 4c 0a  fe c1 08 d1 8a 6c 0c 5a  |T.....L......l.Z|
00000130  8a 74 0b bb 00 70 8e c3  31 db b8 01 02 cd 13 72  |.t...p..1......r|
00000140  2a 8c c3 8e 06 48 7c 60  1e b9 00 01 8e db 31 f6  |*....H|`......1.|
00000150  31 ff fc f3 a5 1f 61 ff  26 42 7c be 7f 7d e8 40  |1.....a.&B|..}.@|
00000160  00 eb 0e be 84 7d e8 38  00 eb 06 be 8e 7d e8 30  |.....}.8.....}.0|
00000170  00 be 93 7d e8 2a 00 eb  fe 47 52 55 42 20 00 47  |...}.*...GRUB .G|
00000180  65 6f 6d 00 48 61 72 64  20 44 69 73 6b 00 52 65  |eom.Hard Disk.Re|
00000190  61 64 00 20 45 72 72 6f  72 00 bb 01 00 b4 0e cd  |ad. Error.......|
000001a0  10 ac 3c 00 75 f4 c3 00  00 00 00 00 00 00 00 00  |..<.u...........|
000001b0  00 00 00 00 00 00 00 00  9b 09 0b 00 00 00 00 20  |............... |
000001c0  21 00 82 4b 81 0a 00 08  00 00 00 00 80 00 80 4b  |!..K...........K|
000001d0  82 0a 83 fe ff ff 00 08  80 00 00 f8 7f 04 00 00  |................|
000001e0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
000001f0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 55 aa  |..............U.|
00000200

od:

root@workstation:/home/sjas/ftp# dd if=/dev/loop0 bs=512 count=1 2>/dev/null | od -v -A d -t x2z
0000000 48eb 1090 d08e 00bc b8b0 0000 d88e c08e  >.H..............<
0000016 befb 7c00 00bf b906 0200 a4f3 21ea 0006  >...|.........!..<
0000032 be00 07be 0438 0b75 c683 8110 fefe 7507  >....8.u........u<
0000048 ebf3 b416 b002 bb01 7c00 80b2 748a 0203  >.........|...t..<
0000064 0080 8000 3e60 0244 0800 90fa f690 80c2  >....`>D.........<
0000080 0275 80b2 59ea 007c 3100 8ec0 8ed8 bcd0  >u....Y|..1......<
0000096 2000 a0fb 7c40 ff3c 0274 c288 f652 80c2  >. ..@|<.t...R...<
0000112 5474 41b4 aabb cd55 5a13 7252 8149 55fb  >tT.A..U..ZRrI..U<
0000128 75aa a043 7c41 c084 0575 e183 7401 6637  >.uC.A|..u....t7f<
0000144 4c8b be10 7c05 44c6 01ff 8b66 441e c77c  >.L...|.D..f..D|.<
0000160 1004 c700 0244 0001 8966 085c 44c7 0006  >....D...f.\..D..<
0000176 6670 c031 4489 6604 4489 b40c cd42 7213  >pf1..D.f.D..B..r<
0000192 bb05 7000 7deb 08b4 13cd 0a73 c2f6 0f80  >...p.}....s.....<
0000208 f084 e900 008d 05be c67c ff44 6600 c031  >........|.D..f1.<
0000224 f088 6640 4489 3104 88d2 c1ca 02e2 e888  >..@f.D.1........<
0000240 f488 8940 0844 c031 d088 e8c0 6602 0489  >..@.D.1......f..<
0000256 a166 7c44 3166 66d2 34f7 5488 660a d231  >f.D|f1.f.4.T.f1.<
0000272 f766 0474 5488 890b 0c44 443b 7d08 8a3c  >f.t..T..D.;D.}<.<
0000288 0d54 e2c0 8a06 0a4c c1fe d108 6c8a 5a0c  >T.....L......l.Z<
0000304 748a bb0b 7000 c38e db31 01b8 cd02 7213  >.t...p..1......r<
0000320 8c2a 8ec3 4806 607c b91e 0100 db8e f631  >*....H|`......1.<
0000336 ff31 f3fc 1fa5 ff61 4226 be7c 7d7f 40e8  >1.....a.&B|..}.@<
0000352 eb00 be0e 7d84 38e8 eb00 be06 7d8e 30e8  >.....}.8.....}.0<
0000368 be00 7d93 2ae8 eb00 47fe 5552 2042 4700  >...}.*...GRUB .G<
0000384 6f65 006d 6148 6472 4420 7369 006b 6552  >eom.Hard Disk.Re<
0000400 6461 2000 7245 6f72 0072 01bb b400 cd0e  >ad. Error.......<
0000416 ac10 003c f475 00c3 0000 0000 0000 0000  >..<.u...........<
0000432 0000 0000 0000 0000 099b 000b 0000 2000  >............... <
0000448 0021 4b82 0a81 0800 0000 0000 0080 4b80  >!..K...........K<
0000464 0a82 fe83 ffff 0800 0080 f800 047f 0000  >................<
0000480 0000 0000 0000 0000 0000 0000 0000 0000  >................<
0000496 0000 0000 0000 0000 0000 0000 0000 aa55  >..............U.<
0000512

When i know where to look at, I prefer od, as it lets you see the position in decimal bytes (first column, compare to previous output). This helps A LOT when using dd input where you skip-ed the first N blocks / sectors, since you can read wether you are looking at the part which you wanted to examine.

Some notes on its parameters:

  • -A d = show position in decimals. Use x for hexadecimal.
  • -t x1z = show hex output, double-byte-wise (x2, use x1 for single-byte-wise output), z shows the data in the rightmost column.
  • --endian=little = choose endianness. Since this is a x86_64 intel cpu, we need little endian. I could have omitted this, but didn't for illustrating.
  • While still searching on the disk for data (using the dd-to-od from above, but piped ot less, using the -v flag with od is pratical, as it will condense lines consisting only of zeroes, showing only an asterisk.

Now that the basics are covered here, the rest should be easy, so only some more notes along the way:

  • No need to specify the blocksize with dd, since its 512 bytes by default.
  • Change it, in case you know how many bytes you want to jump around and want to be able to calculate easier (use bs=1024 and count=20 to read 20KiB from disk, instead of thinking it's count=40 what you need.
  • Using dd with the skip option, jumps so-and-so many blocks forward. For the sake of brevity, assume that both blocks and sectors are 512 bytes long. Remeber the output of parted in sectors from above?
  • Do use losetup, when kpartx fails.

result

I was able to discern that the backup was indeed broken, as there was not magic ext4 number present anywhere.

0xEF53 was nowhere to be found at the 0x38 offset after the initial padding of 1024 bytes in front of the start of the filesystem. Such info can be found here, for example.

At least I got some training with that stuff, been a while I got around to do so.

firewall with systemd file
posted on 2016-09-14 00:38

Some while ago I created a firewall script here, but this was prior to systemd. Now here's an update on how to fix this. First the unit-file, then the firewallscript in fullquote again.

prerequisites

apt install -y libnetfilter-conntrack3 libnfnetlink0
echo "net.netfilter.nf_conntrack_acct=1" >> /etc/sysctl.d/iptables.conntrack.accounting.conf

systemd unit file

/lib/systemd/system/firewall.service:

[Unit]
Description=Do some Firewalling.
Requires=local-fs.target
After=local-fs.target
Before=network.target

[Install]
WantedBy=multi-user.target

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/sbin/firewall start
ExecStop=/usr/sbin/firewall stop

firewallscript

/usr/sbin/firewall:

#!/bin/bash

# aliasing
IPTABLES=$(which iptables)
# set IF to work on
O=eth0
I=eth0


# load kernel modules
modprobe ip_conntrack
modprobe ip_conntrack_ftp

case "$1" in

    start)
        echo 60 > /proc/sys/net/ipv4/tcp_fin_timeout
        echo 0 > /proc/sys/net/ipv4/tcp_ecn

        echo -n "Starting stateful paket inspection firewall... "

        # delete/flush old/existing chains
        $IPTABLES -F
        # delete undefined chains
        $IPTABLES -X

        # create default chains
        $IPTABLES -N INPUT
        $IPTABLES -N OUTPUT

        # create log-drop chain
        $IPTABLES -N LOGDROP

        # set default chain-actions, accept all outgoing traffic per default
        $IPTABLES -P INPUT LOGDROP
        $IPTABLES -P OUTPUT ACCEPT
        $IPTABLES -P FORWARD ACCEPT

        # make NAT Pinning impossible
        $IPTABLES -A INPUT -p udp --dport 6667 -j LOGDROP
        $IPTABLES -A INPUT -p tcp --dport 6667 -j LOGDROP
        $IPTABLES -A INPUT -p tcp --sport 6667 -j LOGDROP
        $IPTABLES -A INPUT -p udp --sport 6667 -j LOGDROP
        $IPTABLES -A OUTPUT -p tcp --dport 6667 -j LOGDROP
        $IPTABLES -A OUTPUT -p udp --dport 6667 -j LOGDROP
        $IPTABLES -A OUTPUT -p tcp --sport 6667 -j LOGDROP
        $IPTABLES -A OUTPUT -p udp --sport 6667 -j LOGDROP

        # drop invalids
        $IPTABLES -A INPUT -m conntrack --ctstate INVALID -j LOGDROP

        # allow NTP and established connections
        $IPTABLES -A INPUT -p udp --dport 123 -j ACCEPT
        $IPTABLES -A INPUT -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
        $IPTABLES -A INPUT -i lo -j ACCEPT

        # pings are allowed
        $IPTABLES -A INPUT -p icmp --icmp-type 8 -m conntrack --state NEW -j ACCEPT

        # drop not routable networks
        $IPTABLES -A INPUT -i $I -s 169.254.0.0/16 -j LOGDROP
        $IPTABLES -A INPUT -i $I -s 172.16.0.0/12 -j LOGDROP
        $IPTABLES -A INPUT -i $I -s 192.0.2.0/24 -j LOGDROP
        #$IPTABLES -A INPUT -i $I -s 192.168.0.0/16 -j LOGDROP
        #$IPTABLES -A INPUT -i $I -s 10.0.0.0/8 -j LOGDROP
        $IPTABLES -A INPUT -s 127.0.0.0/8  ! -i lo -j LOGDROP




        # OPEN PORTS FOR USED SERVICES

        ## SSH
        $IPTABLES -A INPUT -i $I -p tcp -m conntrack --ctstate NEW --dport 22 -j ACCEPT

        ## HTTPD
        #$IPTABLES -A INPUT -i $I -p tcp -m conntrack --ctstate NEW --dport 80 -j ACCEPT
        #$IPTABLES -A INPUT -i $I -p tcp -m conntrack --ctstate NEW --dport 443 -j ACCEPT

        ## OVPN
        #$IPTABLES -A INPUT -i $I -p udp -m conntrack --ctstate NEW --dport 1194 -j ACCEPT

        ## MySQL
        #$IPTABLES -A INPUT -i $I -p tcp -m conntrack --ctstate NEW --dport 3306 -j ACCEPT






        # Portscanner will be blocked for 15 minutes
        $IPTABLES -A INPUT  -m recent --name psc --update --seconds 900 -j LOGDROP

        # only use when ports not available from the internet
        $IPTABLES -A INPUT ! -i lo -m tcp -p tcp --dport 1433  -m recent --name psc --set -j LOGDROP
        $IPTABLES -A INPUT ! -i lo -m tcp -p tcp --dport 3306  -m recent --name psc --set -j LOGDROP
        $IPTABLES -A INPUT ! -i lo -m tcp -p tcp --dport 8086  -m recent --name psc --set -j LOGDROP
        $IPTABLES -A INPUT ! -i lo -m tcp -p tcp --dport 10000 -m recent --name psc --set -j LOGDROP

        ### drop ms specific WITHOUT LOGGING - because: else too much logging
        $IPTABLES -A INPUT -p UDP -m conntrack --ctstate NEW --dport 137:139 -j DROP
        $IPTABLES -A INPUT -p UDP -m conntrack --ctstate NEW --dport 67:68 -j DROP

        # log packets to be dropped and drop them afterwards
        $IPTABLES -A INPUT -j LOGDROP
        $IPTABLES -A LOGDROP -j LOG --log-level 4 --log-prefix "dropped:"
        $IPTABLES -A LOGDROP -j DROP

        echo "Done."
    ;;

    stop)
        echo -n "Stopping stateful paket inspection firewall... "
        /etc/init.d/fail2ban stop
        # flush
        $IPTABLES -F
        # delete
        $IPTABLES -X
        # set default to accept all incoming and outgoing traffic
        $IPTABLES -P INPUT ACCEPT
        $IPTABLES -P OUTPUT ACCEPT
        echo "Done."
    ;;

    restart)
        echo -n "Restarting stateful paket inspection firewall... "
        echo -n
        /etc/init.d/firewall stop
        /etc/init.d/firewall start
        /etc/init.d/fail2ban start
    ;;

    status)
        $IPTABLES -L -vnx --line-numbers | \
        sed ''/Chain[[:space:]][[:graph:]]*/s//$(printf "\033[31;1m&\033[0m")/'' | \
        sed ''/^num.*/s//$(printf "\033[31m&\033[0m")/'' | \
        sed ''/[[:space:]]DROP/s//$(printf "\033[31m&\033[0m")/'' | \
        sed ''/REJECT/s//$(printf "\033[31m&\033[0m")/'' | \
        sed ''/ACCEPT/s//$(printf "\033[32m&\033[0m")/'' | \
        sed -r ''/\([ds]pt[s]\?:\)\([[:digit:]]\+\(:[[:digit:]]\+\)\?\)/s//$(printf "\\\1\033[35;1m\\\2\033[0m")/''| \
        sed -r ''/\([0-9]\{1,3\}\\.\)\{3\}[0-9]\{1,3\}\(\\/\([0-9]\)\{1,3\}\)\{0,1\}/s//$(printf "\033[37;1m&\033[0m")/g'' | \
        sed -r ''/\([^n][[:space:]]\)\(LOGDROP\)/s//$(printf "\\\1\033[1;31m\\\2\033[0m")/'' | \
        sed -r ''/[[:space:]]LOG[[:space:]]/s//$(printf "\033[36;1m&\033[0m")/''
    ;;

    monitor)
        if [ -n "$2" ]
            then $(which watch) -n1 -d $IPTABLES -vnxL "$2" --line-numbers
            else $(which watch) -n1 -d $IPTABLES -vnxL --line-numbers; fi
    ;;

    *)
        echo "Usage: $0 {start|stop|status|monitor [<chain>]|restart}"
        exit 1
    ;;

esac

exit 0

The coloring at the status part when using firewall status is borked. It works, but its completely shit from what I know now. The '' were a single double-apostrophe, but I was not good enough with bash when I copy pasted it and tried to color the shell output. Some day I may fix it. Hopefully.

finishing

chmod u+x /usr/sbin/firewall
systemctl enable firewall
firewall start

usage

This should suffice, just try it:

firewall
firewall start
firewall stop
firewall restart
firewall status
firewall monitor
linux bonding without ifenslave
posted on 2016-09-13 15:46

Sometimes you configured bonding on the switch and on the host itself. After a reboot, you figure out your server won't come up.

iKVM tells you, networking's not working.

Now the configuration can be fixed easily, but what if you simply forgot about the ifenslave package? Since your networking config is out of order, how do you get the files there?

  • boot livedisk?
  • manually plug the cable into another switchport and reconfigure unbonded networking?
  • use an USB stick plugged directly into the server and copy the missing package onto there so you can install it?

Heres another way:

#modprobe bond
# (the bonding module has to be present in the kernel)

echo "+bond0" >  /sys/class/net/bonding_masters

echo "+eth0" > /sys/class/net/bond0/bonding/slaves
echo "+eth1" > /sys/class/net/bond0/bonding/slaves

# Remove a slave interface from bond0

echo "-eth0" > /sys/class/net/bond0/bonding/slaves

# Delete a bond interface

echo "-bond0" >  /sys/class/net/bonding_masters

Official documentation can be found here.

linux clear buffers and cache
posted on 2016-09-13 14:09

Use this to clear all buffers and caches at once:

free && sync && echo 3 > /proc/sys/vm/drop_caches && free

More in-depth info here.

linux ssd and TRIM
posted on 2016-09-12 13:44

One of my setups is an encrypted LVM on top of a SSD.

The important part here is, should you want to TRIM the SSD, then TRIM has to be available on all layers:

  • SSD
  • dm-crypt
  • LVM

Now before you do anything, you might want to jump to the back of this post and to a test with fio for getting a baseline, so you got some numbers to compare for after you changed everything.

check storage media

hdparm, like always, is your friend:

root@ctr-014:~# hdparm -I /dev/sda | grep TRIM
    *   Data Set Management TRIM supported (limit 8 blocks)

If there is nothing to be found, TRIM just won't work for you.

dm-crypt

grep discard /etc/crypttab:

sjas@host:~/blog$ grep discard /etc/crypttab 
sda5_crypt UUID=985f3826-e502-4402-ad01-5c13b84e9141 none luks,discard

If discard is not present, add it there.

LVM

grep issue_discards /etc/lvm/lvm.conf:

root@ctr-014:~# grep issue_discards /etc/lvm/lvm.conf
    #issue_discards = 0
    issue_discards = 1

Set it to "1" if it is not already.

update initramfs

Debian:

update-initramfs -u

RedHat:

dracut -f

reboot

In case you changed anything above, to a restart so your settings become active.

TRIM !

for fs in $(lsblk -o MOUNTPOINT,DISC-MAX,FSTYPE | grep -E '^/.* [1-9]+.* ' | awk '{print $1}'); do fstrim "$fs"; done

Voila!

cron

You might want to put this into a file in /etc/cron.weekly with a #!/bin/sh shebang, to it will be run automatically.

test method

Test were done with fio:

fio --randrepeat=1 --ioengine=libaio --direct=1 --gtod_reduce=1 --name=test --filename=test --bs=4k --iodepth=64 --size=512M --readwrite=randrw --rwmixread=75

Keep in mind these are single-threaded thus somewhat aenemic, but the result should become visible.

after

read iops = 19947
write iops =  6671

before

read iops = 3374 
write iops =  1128

actual measurement sample

root@ctr-014:/home/sjas# fio --randrepeat=1 --ioengine=libaio --direct=1 --gtod_reduce=1 --name=test --filename=test --bs=4k --iodepth=64 --size=512M --readwrite=randrw --rwmixread=75
test: (g=0): rw=randrw, bs=4K-4K/4K-4K/4K-4K, ioengine=libaio, iodepth=64
fio-2.1.11
Starting 1 process
test: Laying out IO file(s) (1 file(s) / 512MB)
Jobs: 1 (f=1): [m(1)] [100.0% done] [78716KB/26344KB/0KB /s] [19.7K/6586/0 iops] [eta 00m:00s]
test: (groupid=0, jobs=1): err= 0: pid=3245: Mon Sep 12 13:40:44 2016
  read : io=392888KB, bw=79790KB/s, iops=19947, runt=  4924msec
  write: io=131400KB, bw=26686KB/s, iops=6671, runt=  4924msec
  cpu          : usr=5.77%, sys=33.72%, ctx=71337, majf=0, minf=6
  IO depths    : 1=0.1%, 2=0.1%, 4=0.1%, 8=0.1%, 16=0.1%, 32=0.1%, >=64=100.0%
     submit    : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
     complete  : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.1%, >=64=0.0%
     issued    : total=r=98222/w=32850/d=0, short=r=0/w=0/d=0
     latency   : target=0, window=0, percentile=100.00%, depth=64

Run status group 0 (all jobs):
   READ: io=392888KB, aggrb=79790KB/s, minb=79790KB/s, maxb=79790KB/s, mint=4924msec, maxt=4924msec
  WRITE: io=131400KB, aggrb=26685KB/s, minb=26685KB/s, maxb=26685KB/s, mint=4924msec, maxt=4924msec

Disk stats (read/write):
    dm-2: ios=95567/32093, merge=0/0, ticks=197872/140256, in_queue=355552, util=97.95%, aggrios=98222/33021, aggrmerge=0/0, aggrticks=203680/161852, aggrin_queue=366328, aggrutil=97.02%
    dm-0: ios=98222/33021, merge=0/0, ticks=203680/161852, in_queue=366328, util=97.02%, aggrios=96973/32744, aggrmerge=1249/277, aggrticks=197660/149212, aggrin_queue=347000, aggrutil=96.94%
  sda: ios=96973/32744, merge=1249/277, ticks=197660/149212, in_queue=347000, util=96.94%
Next

This blog covers .csv, .htaccess, .vmx, /etc/crypttab, /etc/network/interfaces, /etc/sudoers, /proc, 14.04, AS, ASA, ControlPanel, DS1054Z, GPT, HWR, Hyper-V, IPSEC, KVM, LSI, LVM, LXC, MBR, MTU, PHP, PKI, R, RAID, S.M.A.R.T., SNMP, SSD, SSL, TLS, TRIM, VEEAM, VMware, VServer, VirtualBox, Virtuozzo, XenServer, acpi, adaptec, algorithm, apache, apachebench, apple, arcconf, arch, architecture, areca, arping, asa, asdm, awk, backup, bandit, bash, benchmarking, binding, bitrate, blackarmor, blowfish, bochs, bond, bonding, booknotes, bootable, bsd, btrfs, buffer, c-states, cache, caching, ccl, centos, certificate, certtool, cgdisk, cheatsheet, chrome, chroot, cisco, clamav, cli, clp, cluster, coleslaw, common lisp, console, container, containers, controller, cron, cryptsetup, csync2, cu, cups, cygwin, d-states, database, date, db2, dcfldd, dcim, dd, debian, debug, debugger, debugging, desktop, df, dhclient, dhcp, diff, dig, display manager, dm-crypt, dmesg, dmidecode, dns, docker, dos, drivers, dtrace, dtrace4linux, du, dynamictracing, e2fsck, eBPF, ebook, efi, egrep, emacs, encoding, env, error, ess, esx, esxcli, esxi, ethtool, evil, expect, exportfs, factory reset, factoryreset, fail2ban, fbsd, fedora, file, filesystem, find, fio, firewall, firmware, flashrom, forensics, free, freebsd, freedos, fritzbox, fsck, fstrim, ftp, ftps, g-states, gentoo, ghostscript, git, git-filter-branch, github, gitolite, gnutls, gradle, grep, grub, grub2, guacamole, hardware, haskell, hdd, hdparm, hellowor, hexdump, history, howto, htop, htpasswd, http, httpd, https, i3, icmp, ifenslave, iftop, iis, imagemagick, init, innoDB, inodes, intel, ios, iostat, ip, iperf, iphone, ipmi, ipmitool, iproute2, ipsec, iptables, ipv6, irc, irssi, iw, iwconfig, iwlist, iwlwifi, jailbreak, jails, java, javascript, javaws, juniper, junit, kali, kde, kernel, keyremap, kpartx, krypton, lacp, lamp, languages, ldap, ldapsearch, less, leviathan, liero, lightning, links, linux, linuxin3months, lisp, list, lmctfy, loadbalancing, locale, log, logrotate, looback, losetup, lsblk, lsi, lsof, lsusb, lsyncd, luks, lvextend, lvm, lvm2, lvreduce, lxc, lxde, macbook, magento, mailclient, mailing, mailq, manpages, markdown, mbr, mdadm, megacli, micro sd, microsoft, minicom, mkfs, mktemp, mod_pagespeed, mod_proxy, modbus, modprobe, mount, mouse, movement, mpstat, multitasking, myISAM, mysql, mysql 5.7, mysql workbench, mysqlcheck, mysqldump, nagios, nas, nat, nc, netfilter, networking, nfs, nginx, nmap, nocaps, nodejs, numberingsystem, numbers, od, opcode-cache, openVZ, openlierox, openssl, openvpn, openvswitch, openwrt, oracle linux, os, oscilloscope, overview, parallel, parameter expansion, parted, passwd, patch, pdf, performance, pfsense, php, phpmyadmin, pi, pidgin, pidstat, pins, plesk, plugin, posix, postfix, postgres, postgresql, poudriere, preview, profiling, prompt, promxox, proxmox, ps, puppet, pv, pvresize, python, qemu, qemu-img, qm, qmrestore, quicklisp, r, racktables, raid, raspberry pi, raspberrypi, raspbian, rbpi, rdp, redhat, redirect, registry, requirements, resize2fs, rewrites, rhel, rigol, roccat, routing, rs0485, rs232, rsync, s-states, s_client, samba, sar, sata, sbcl, scp, screen, scripting, seafile, seagate, security, sed, serial, serial port, setup, sftp, sg300, shell, shopware, shortcuts, showmount, slattach, slip, smbclient, snmpget, snmpwalk, software RAID, software raid, softwareraid, sophos, spacemacs, spam, specification, speedport, spi, sqlite, squid, ssd, ssh, ssh-add, sshd, ssl, stats, storage, strace, submodules, subzone, sudo, sudoers, sup, swaks, switch, switching, synaptics, synergy, sysfs, systemd, systemtap, tar, tcpdump, tcsh, tee, telnet, terminal, testdisk, testing, throughput, tmux, tomcat, top, tput, trafficshaping, ttl, tuning, tunnel, tunneling, typo3, uboot, ubuntu, udev, uefi, uname, unetbootin, unit testing, upstart, uptime, usb, usbstick, utf8, utm, utm 220, ux305, vcs, vgchange, vim, virtualbox, virtualization, visual studio code, vlan, vmstat, vmware, vnc, vncviewer, voltage, vpn, vsphere, w, w701, wakeonlan, wargames, web, weechat, wget, whois, wicd, wifi, windowmanager, windows, wine, wireshark, wpa, wpa_passphrase, wpa_supplicant, x2x, xfce, xfreerdp, xmodem, xterm, xxd, yum, zones, zsh

View posts from 2016-09, 2016-08, 2016-07, 2016-06, 2016-05, 2016-04, 2016-03, 2016-02, 2016-01, 2015-12, 2015-11, 2015-10, 2015-09, 2015-08, 2015-07, 2015-06, 2015-05, 2015-04, 2015-03, 2015-02, 2015-01, 2014-12, 2014-11, 2014-10, 2014-09, 2014-08, 2014-07, 2014-06, 2014-05, 2014-04, 2014-03, 2014-01, 2013-12, 2013-11, 2013-10


Unless otherwise credited all material Creative Commons License by sjas