Setting the ESX 3.5 Multi-Pathing Policy From the CLI

This one is taken from the first objective in the VMware Enterprise Admin Exam Blueprint. Specifically from the skills section:

– Perform advanced multi-pathing configuration
— Configure multi-pathing policy
— Configure round-robin behavior using command-line tools

After logging into the host via SSH, and getting to root, this can be done with the “esxcfg-mpath” command. Let’s take a look at this command:

[root@ProfessionalVMware root]# esxcfg-mpath
esxcfg-mpath <options> [–lun=<LUN>] [–path=<path>]
-l|–list                     List all LUNs and their paths.
-p|–policy <type>            Set the policy for a specific LUN.  Requires
                              a –lun flag.  Type must be one of mru, rr, fixed or custom.
-H|–custom-hba-policy        Set the custom HBA policy value.  Must be one of
                              mru, preferred, any, minq.
-T|–custom-target-policy     Set the custom target policy value. Must be one of
                              mru, preferred, any
-C|–custom-max-commands      Set the custom policy value for max commands
-B|–custom-max-blocks        Set the custom policy value for max blocks
-s|–state <on|off>           Set the state for a specific LUN Path.  Requires
                              both –lun and –path flags.
-f|–preferred                Set the given path to be preferred for the
                              given LUN.  Requires both –path and –lun flags.
-q|–query                    Query the information on a specific LUN. 
                              Requires a –lun flag.
-P|–path=vmhbaX:X:X          Used to specify a path for setting the
                              path state or preferred path.  Uses the
                              VMkernel internal path name.
-L|–lun=vmhbaX:X:X           Indicate which LUN to operate on.  This can be
                              either the internal VMkernel vmhba name for
                              this LUN (vmhbaX:X:X) or the vml name as
                              found in /vmfs/devices/disks.
-v|–verbose                  Show all information about the LUNs and
                              paths, otherwise a minimal set of data
                              is displayed to conserve space.
-b|–bulk                     Bulk path listing suitable for parsing.
-a|–hbas                     List HBAs on the system with a unique ID
                              if one is available.
-h|–help                     Show this message.
-r|–restore                  Restore path setting to configured values
                              on system start. (INTERNAL USE ONLY)

Quite the command, isn’t it? And that is but half the output. The particular switches we are interested in are –p or –policy to which we’ll feed the “rr” or round robin switch. We’ll follow that up with the –L or –lun to specify which lun we’re operating on. Here’s an example:

[root@ProfessionalVMware root]# esxcfg-vmhbadevs
vmhba0:0:0     /dev/sda                       
[root@ProfessionalVMware root]# esxcfg-mpath –policy=rr –lun=vmhba0:0:0
Setting vmhba0:0:0 policy to rr

In all practical terms, on my lab box that didn’t accomplish much, as there is only one actual path to the disk, however, we can still see the changes in the VI Client:

Windows7-20100204-182320[1]

Note: esxcfg-mpath is not actually listed in the tools section for this objective, but is indeed the way to accomplish this.