PowershellWindows Server

How to Enable and Configure MPIO on Windows Server 2016/2012R2

By April 12, 2021August 19th, 2021No Comments

In this post we will consider how to install and configure MPIO on Windows Server 2016/2012 R2. MPIO (Multi—Path Input Output) is a technology that allows to build fault-tolerant transport to a data storage system (or a storage server) by using redundant paths. Additional paths between a server and a storage are created using redundant physical components (switches, cables, adapters or NICs). This redundancy type has a drawback: an operating system may see the same LUN at different paths and treat it as different drives. If a server can access a logical disk (LUN) using multiple iSCSI initiator adapter or multiple Fibre Channel ports, the Device/Disk Manager without the MPIO module will show more LUNs than there actually are (= the number of paths to a LUN * the number of presented LUNs) if an MPIO module is not installed .

The following screenshot shows that Windows without MPIO sees 2 drives with different paths, which are in fact the same LUN (the list of presented disks may be displayed using the Get-Disk PowerShell cmdlet).

get-disk - lun displaying as 2 drives

If the OS supports MPIO, it will see each of the disks presented to it in one copy. If MPIO is enabled, a server may access data on a storage using multiple paths that makes access to a connected LUN faster and allows using multiple network or HBA adapters.
MPIO may use an alternative logical path if one or more components fail, thus making an operating system use another route to access a logical disk (LUN) maintaining data access consistency. So, MPIO is an important component of a fail-tolerant storage and data access system, and MPIO modules can distribute the load on the same LUN across different paths. If an OS doesn’t support MPIO, leave only one path to a LUN to prevent data loss. Enable only one Fibre Channel port or one iSCSI initiator adapter on a server. Also, disable additional paths to the LUN on the data storage system and SAN/network switch levels.

Installing MPIO Installation on Windows Server 2016/2012R2

Windows Server supports multi-path input output (MPIO) starting from Windows Server 2008 R2. Microsoft MPIO provides high availability and load balancing using multiple connections to a storage, doesn’t depend on any protocols and supports disk array and storage connection using iSCSI, Fiber Channel and SAS.

By default, MPIO module is disabled on Windows Server. There are two ways to install it in Windows Server 2016:

  • From a graphical interface using Server Manager console;
  • From the PowerShell command line.

Enable MPIO Using Server Manager

  1. Open the Server Manager;
  2. Find and check the Multipath I/O in the Features list ;
  3. Finish MPIO installation and restart the server.

Installing Multipath-IO Using PowerShell

Run the PowerShell console as an administrator and use the following command to install the Windows Server feature:

Add-WindowsFeature -Name 'Multipath-IO'

Add-WindowsFeature -Name 'Multipath-IO' - enabling mpio on Windows Server

To make sure that MPIO has been installed on your Windows Server, run this command:

Get-WindowsFeature -Name 'Multipath-IO'

windows server - get 'Multipath-IO' powershell

To disable MPIO, enter the following command:

Remove-WindowsFeature -Name 'Multipath-IO'

Configuring MPIO on Windows Server 2016

After installing the MPIO module, you need to activate it for the LUNs that are available by multiple paths. By default, Windows sees each connection to a disk as different logical disks (LUNs). Among MPIO components, there is a special module, MSDSM (Microsoft Device Service Module) that allows you to manage load balancing policies. By default, MPIO is installed together with the standard Microsoft DSM. However, in most cases it is recommended to install the DSM module provided by your storage manufacturer (IBM DSM, HP DSM MPIO, Dell DSM, etc.). Typically, native DSM offers better performance and more features than Microsoft (since the manufacturer builds its DSM based on the operating conditions and characteristics of its hardware).

Allow the DSM module by Microsoft (MSDSM) to automatically merge SAN disks based on the connection type. MSDSM automatically detects LUNs that have multiple paths to a storage and supports most popular storage devices.

You can do it from the command prompt:

  • For SAS disks: Enable-MSDSMAutomaticClaim -BusType SAS
  • For iSCSI disks: Enable-MSDSMAutomaticClaim -BusType iSCSI

You can do the same using the mpclaim tools (it appeared in Windows 2008 R2). The following command will scan all devices detected by a system, find those that have multiple paths and enable MPIO support for them:

mpclaim.exe -r -i -a ""

You can also enable DSM in the GUI. Open the Server Manager and select MPIO in the Tools menu (or run the command: mpiocpl).

Go to the Discover Multi—Paths tab, check Add support for SASdevices (or Add supportfor iSCSI devices if you are using iSCSI storage) and click Add. Then restart your server.

discover multi-paths: Add support for SAS and iSCSI devices

After the restart, open the Device Manager (or the Disk Manager) and make sure that the number of connected disks (LUNs) available to your server has reduced twice (if there are two paths to your storage device).

You can manage the list of devices with MPIO support enabled in the MPIO Devices tab (or using the Get-MSDSMSupportedHw command).

mpio devices

You can add new MPIO devices by clicking Add or from PowerShell:

New-MSDSMSupportedHw -VendorId <vend> -ProductId <product>If you are deploying a cluster, configure MPIO on all nodes.

If you connect an iSCSI target via 2 paths and want to use MPIO for it, select iSCSI LUN when you connect a Target, click Connect and check the Enable multi—path option.

enable multipath for iscsi device on windows server 2016

Then click Advanced and bind different initiator IP addresses to different target IP addresses.

Windows Server 2016 multipath iscsi - bind different target IP addresses to different initiators

You can get current MPIO settings using PowerShell:

Get-MPIOSetting

Get-MPIOSetting
PathVerificationState     : Disabled
PathVerificationPeriod    : 30
PDORemovePeriod           : 20
RetryCount                : 3
RetryInterval             : 1
UseCustomPathRecoveryTime : Disabled
CustomPathRecoveryTime    : 40
DiskTimeoutValue          : 60

You can change MPIO timer settings as follows (for example, let’s enable recommended settings for the all-flash array):

Set-MPIOSetting -NewPathRecoveryInterval 20 -CustomPathRecovery Enabled -NewPDORemovePeriod 30 -NewDiskTimeout 60 -NewPathVerificationState Enabled

The following MPIO balancing policies are available:

  • FOO — Fail Over Only
  • RR — Round Robin
  • LQD — Least Queue Depth
  • LB — Least Blocks

To change a balancing policy:

Set-MSDSMGlobalLoadBalancePolicy -Policy RR

You can also select the balancing policy in the MPIO tab of the connected LUN properties. In this example, the Round Robin policy is selected for the array.

change MPIO load balancing policy on Windows Server 2016

To view the full list of PowerShell commands available in the MPIO module, run this command:

Get-Command –Module Mpio

powershell mpio module

SAN (Disk) Policy on Windows Server

Windows has a special disk policy (SAN Policy) that determines whether disks must be mounted automatically when they are connected to a host.

You can get the current SAN Policy setting using diskpart. By default, Offline Shared policy for SAN is used:

diskpart
DISKPART>>san</codeDue to this SAN policy, external storage LUNs may be disabled after a restart. Check the post The Disk Is Offline Because of Policy Set by an Administrator.

To mount the drives automatically, change the SAN Policy value to OnlineAll.

DISKPART> san policy=OnlineAll

diskpart change san policy from offline shared to onlineall

Possible SAN Policy values:

OfflineAllAll disks are offline by default
OfflineInternalAll disks on internal buses are offline
OfflineSharedAll disks connected via iSCSI, FC or SAS are offline
OnlineAllAll disks get online automatically (recommended)

Leave a Reply