Windows Server 2012 and our completely FREE Hyper-V Server 2012 certainly have some really cost effective new storage options, with Storage Spaces and Hyper-V over SMB 3.0. However, many IT Pros have already invested in iSCSI shared storage and, as a result, many Hyper-V deployments also need to be able to leverage these existing storage investments.
iSCSI? No problem! Windows Server 2012 and Hyper-V Server 2012 include native support for a software iSCSI initiator as well as MPIO ( Multipath IO ) for resiliency and load balancing of storage IO over multiple network paths.
In this article, we’ll walk through the process of connecting Windows Server 2012 and Hyper-V Server 2012 to common iSCSI storage arrays. Because most of my IT Pro friends are running Hyper-V either on Windows Server 2012 Server Core or Hyper-V Server 2012, both options without a local console GUI, I’ll be providing my examples below in PowerShell.
NOTE: In this article, I make the assumption that your iSCSI storage array is already configured and that your Hyper-V host is already physically attached and zoned into your iSCSI storage network.
- Don’t have an iSCSI Storage Array? Did you know that Windows Server 2012 includes an iSCSI Target role that, along with Failover Clustering, allows it to become a cost-effective and highly-available iSCSI Storage Array? Walk through the process of getting this configured in the following Step-by-Step Guide:
DO IT: Step-by-Step: Build a Windows Server 2012 Storage Server
Let’s Get Things “Started” …
A software iSCSI initiator is installed by default on Windows Server 2012 and Hyper-V Server 2012 as the MSiSCSI service. However, the MSiSCSI service isn’t set to automatically startup, so we can start the MSiSCSI service with the following PowerShell command lines:
Set-Service –Name MSiSCSI –StartupType Automatic
After running the above cmdlets, you can check on the status of the MSiSCSI service with the following command line:
Get-Service –Name MSiSCSI
Now Let’s Get “Connected’ …
After starting the MSiSCSI service, we can connect from our Hyper-V host to the iSCSI target on the storage array with the following PowerShell command line:
New-IscsiTargetPortal –TargetPortalAddress <IP_Address or FQDN of storage array>
$target = Get-IscsiTarget
Connect-IscsiTarget –NodeAddress $target.NodeAddress
If you’re successfully connected to the target on your iSCSI storage array, you should see the connection status returned with the following cmdlet:
Now, let’s make the session for this iSCSI connection persist across reboots with the following command:
Get-IscsiSession | Register-IscsiSession
You can check to make sure the IsPersistent value is True for this session with the following command line:
We’re ready to start using our new iSCSI disk!
After successfully persisting our connection to the iSCSI target session, we’re ready to begin using our new iSCSI disk. To verify that your Hyper-V host sees the new iSCSI disk, use the following command:
Get-Disk | Where-Object BusType –eq “iSCSI”
Note the disk Number in the first column and verify that the Partition Style column shows “Raw” ( ie. unused ) for this new disk. To initialize and format the new disk, use the following command line, being careful to specify the correct disk number from the command output above:
Initialize-Disk –Number <Disk_Number> –PartitionStyle GPT –PassThru | New-Partition –AssignDriveLetter –UseMaximumSize | Format-Volume
After this command completes, you can use the following command to confirm the drive letter assigned to the new partition on your iSCSI disk so that you can begin using this path for storing new virtual machines and virtual hard disks!
Great! But … What about High Availability?
Good question! Highly available iSCSI connections are generally configured via MPIO ( Multipath IO ). MPIO support is also included in Windows Server 2012 and Hyper-V Server 2012, but this feature first needs to be installed with the following command line:
After MPIO is installed, configure it to automatically claim all iSCSI devices for MPIO with the following command lines:
Enable-MSDSMAutomaticClaim –BusType iSCSI
Set-MPIOSetting –NewDiskTimeout 60
After running these commands, restart your server for MPIO discovery to take effect. After restarting, you can also configure a Round Robin load-balancing policy for all newly claimed devices with the following command:
Set-MSDSMGlobalDefaultLoadBalancePolicy -Policy RR
NOTE: The above commands leverage the Microsoft MPIO DSM ( Device Specific Module ). Prior to attempting to implement MPIO between your hosts and storage array, be sure to check with your storage array vendor to confirm their compatibility with this DSM. In some cases, your storage vendor may require an alternate DSM and/or a different MPIO configuration. Many storage arrays that are SPC-3 compliant will work with the Microsoft DSM, but we recommend confirming compatibility with your storage vendor before proceeding.
Want to configure this via the GUI tools instead?
PowerShell rocks, but you may also be interested in the configuration steps for iSCSI via the Server Manager and Control Panel GUI tools. For these steps, see the following great article from my good friend and colleague, Chris Avis:
Want more? Become a Virtualization Expert in 20 Days!
This month, my fellow Technical Evangelists and I are writing a new blog article series, titled Become a Virtualization Expert in 20 Days! Each day we’ll be releasing a new article that focuses on a different area of virtualization as it relates to compute, storage and/or networking. Be sure to catch the whole series at:
After you’re done reading the series, if you’d like to learn more and begin preparing for MCSA certification on Windows Server 2012, join our FREE Windows Server 2012 “Early Experts” online study group for IT Pros at: