VMware esxcfg-mpath

In a much earlier post, I went through a slew of esxcfg-* commands to attempt to provide an insight into how to use them in deployments or troubleshooting scenarios. What I didn’t provide, at least with my brief coverage of esxcfg-mpath, is a useful real-world example.

So if you’ve ever found yourself with a few CLARiiONs and 15 or so ESX hosts that are thrashing LUNs like nobody’s business, it might be time get dirty with esxcfg-mpath. Sure, you could try and do this from the GUI, but it will take, like, forever. And using the CLI impressess women. No, really.

So esxcfg-mpath -l will give you a list of paths to LUNs and what’s preferred and what’s active

[[email protected] root]# esxcfg-mpath -l
Disk vmhba0:0:0 /dev/sda (139899MB) has 1 paths and policy of Fixed
 Local 4:0.0 vmhba0:0:0 On active preferred

Disk vmhba1:0:0 /dev/sdb (230400MB) has 2 paths and policy of Most Recently Used
 FC 15:4.0 210000e08b9c1e11<->200400a0b829871d vmhba1:0:0 Standby active preferred
 FC 15:4.0 210000e08b9c1e11<->200500a0b829871e vmhba1:1:0 On

Disk vmhba1:0:1 /dev/sdc (230400MB) has 2 paths and policy of Most Recently Used
 FC 15:4.0 210000e08b9c1e11<->200400a0b829871d vmhba1:0:1 On active preferred
 FC 15:4.0 210000e08b9c1e11<->200500a0b829871e vmhba1:1:1 Standby

Disk vmhba1:0:2 /dev/sdd (230400MB) has 2 paths and policy of Most Recently Used
 FC 15:4.0 210000e08b9c1e11<->200400a0b829871d vmhba1:0:2 Standby active preferred
 FC 15:4.0 210000e08b9c1e11<->200500a0b829871e vmhba1:1:2 On

But what if you want to set a different preferred path? 

[[email protected] root]# esxcfg-mpath –preferred –path=vmhba1:1:0 –lun=vmhba1:0:0
Setting vmhba1:0:0 — vmhba1:1:0 as preferred path

[[email protected] root]# esxcfg-mpath –path=vmhba1:1:0 –lun=vmhba1:0:0 –state=on
Setting vmhba1:0:0 — vmhba1:1:0 state to on

Now you can see the results:

[[email protected] root]# esxcfg-mpath -l
Disk vmhba0:0:0 /dev/sda (139899MB) has 1 paths and policy of Fixed
 Local 4:0.0 vmhba0:0:0 On active preferred

Disk vmhba1:0:0 /dev/sdb (230400MB) has 2 paths and policy of Most Recently Used
 FC 15:4.0 210000e08b9c1e11<->200400a0b829871d vmhba1:0:0 Standby active
 FC 15:4.0 210000e08b9c1e11<->200500a0b829871e vmhba1:1:0 On  preferred

Disk vmhba1:0:1 /dev/sdc (230400MB) has 2 paths and policy of Most Recently Used
 FC 15:4.0 210000e08b9c1e11<->200400a0b829871d vmhba1:0:1 On active preferred
 FC 15:4.0 210000e08b9c1e11<->200500a0b829871e vmhba1:1:1 Standby

Disk vmhba1:0:2 /dev/sdd (230400MB) has 2 paths and policy of Most Recently Used
 FC 15:4.0 210000e08b9c1e11<->200400a0b829871d vmhba1:0:2 Standby active preferred
 FC 15:4.0 210000e08b9c1e11<->200500a0b829871e vmhba1:1:2 On

And you want to make the preferred path active now? Sure. Run esxcfg-rescan followed by the vmhba you want to scan.

Have fun.

3 Comments

  1. Hi there…

    Regarding you last comments “make the preferred path active….run esxcfg-rescan”.. I have tried this with MRU policy + preferred path set, it a rescan does not seem to fail the path back to its preferred path.
    Did you have different results?

    thanks

    Bernie.

  2. Actually,

    Preferred pathing option is not available for MRU policy so I believe it is ignored….It would need to be Fixed.

    This is why the rescan would not move the path to a “tagged” preferred path when set to MRU policy….

    I think….

    BernieT

  3. I think I explained this poorly BernieT. I recall the reason I posted this was because I used to change the policy to fixed, select the path I wanted, rescan, and then change the policy back to MRU. The problem I used to have was that this wasn’t working from the VI Client. I’ll re-test this scenario and get back to you. Cheers.

Comments are closed.