How to Change All LUNs To Round Robin Policy Using PowerCLI

Multipathing

To maintain a constant connection between a host and its storage, ESXi supports multipathing. Multipathing is a technique that lets you use more than one physical path that transfers data between the host and an external storage device.In case of a failure of any element in the SAN network, such as an adapter, switch, or cable, ESXi can switch to another physical path, which does not use the failed component. This process of path switching to avoid failed components is known as path failover.

In addition to path failover, multipathing provides load balancing. Load balancing is the process of distributing I/O loads across multiple physical paths. Load balancing reduces or removes potential bottlenecks.

VMware vSphere includes active/active multipath support to maintain a constant connection between the ESXi host. In this post, I will share the steps to configure Round Robin multipath policy on your vSphere infrastructure using PowerCLI.

Round Robin

The host uses an automatic path selection algorithm rotating through all active paths when connecting to active-passive arrays, or through all available paths when connecting to active-active arrays. RR is the default for several arrays and can be used with both active-active and active-passive arrays to implement load balancing across paths for different LUNs.

Before proceeding to perform this make sure that your SAN/storage supports Round Robin.

Open PowerCLI and connect to your vCenter server

Connect-VIServer vCenter Server IP Address / FQDN

List of all LUNs and their current Multipath Policy configured on vSphere Infra

Get-Vmhost | Get-Scsilun

Also you can identify the LUNs that are currently not configured with the Round Robin Multipath Policy by using below command

Get-VMHost | Get-ScsiLun -LunType disk | Where {$_.MultipathPolicy -notlike "RoundRobin"}

Note:- You can specify other policy also here , example you can use “FIXED” instead of RoundRobin .

Another method for listing LUNs which are not in RR policy with size filter

Get-VMHost | Get-ScsiLun -LunType disk | Where {$_.MultipathPolicy -notlike "RoundRobin"} | Where {$_.CapacityGB -ge 500}

Note:- -ge selects disks with a Capacity GB greater than or equal to 500 GB, you can modify with your required size

Change LUNs to the Round Robin Multipath Policy

Note:- Prior to RUN the command verify that all the Luns are from supported storage and not Local Storage / unsupportedĀ  .

Below Command will change the LUNs which are not in RR to Round Robin Mutipath Policy

Get-VMHost | Get-ScsiLun -LunType disk | Where {$_.MultipathPolicy -notlike "RoundRobin"} | Set-Scsilun -MultiPathPolicy RoundRobin

Below Command will Set the LUNs with Capacity GB greater than or equal to 100 GB and not in RR policy to Round Robin Mutipath Policy .

Get-VMHost | Get-ScsiLun -LunType disk | Where {$_.MultipathPolicy -notlike "RoundRobin"} | Where {$_.CapacityGB -ge 500} | Set-Scsilun -MultiPathPolicy RoundRobin

Conclusion

We have shared the steps to configure all LUNs to Round Robin Multipathing Policy from PowerCLI .Based on the number Luns and Hosts it may take time to complete the action .Using these steps you can set the policy with putting host in maintenance mode and without any disruption in service.