Jaa


Step-by-Step: Speaking iSCSI with Windows Server 2012 and Hyper-V - Become a Virtualization Expert in 20 Days! ( Part 7 of 20 )

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

Start-Service MSiSCSI

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:

Get-IscsiConnection

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:

Get-IscsiSession

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!

Get-Partition

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:

Install-WindowsFeature Multipath-IO

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:

Comments

  • Anonymous
    January 01, 2003
    Thanks for sharing your feedback, Michael! Part 2 of the Hyper-V Cluster article is located at: blogs.technet.com/.../building-a-free-hyper-v-server-2012-cluster-part-2-of-2.aspx Best regards, Keith

  • Anonymous
    January 01, 2003
    Hi Davey, Using the steps in the article above, you should be able to connect to all disks.  However, if you'd like to have the equivalent of the Auto Configure button, you can actually launch iSCSI Initiator Control Panel applet directly on Server Core and Hyper-V Server 2012 by running: C:WindowsSystem32iscsicpl.exe Hope this helps! Keith

  • Anonymous
    January 01, 2003
    Hi Keith Great article on iSCSI.  The one thing that i have not been able to find a way to do with a core machine and PowerShell is the equivalent of click the AutoConfigure button on the volumes and devices tab. I am not sure if that is needed as i have all of my connections and i see my disks listed when i do a get-disk.  But it would be nice to have them listed if at all possible :) Thanks Davey

  • Anonymous
    January 01, 2003
    When using Storage Spaces to present clustered storage to Hyper-V Server 2012 hosts, you can also share one or more folders via SMB 3.0 shares and then store your clustered VM’s on the corresponding UNC path.  As a result, iSCSI targets are not required when using an SMB 3.0 configuration. Actually, I’ve got a step-by-step guide for building a Hyper-V host cluster using exactly this configuration at: •Part 1 - blogs.technet.com/.../step-by-step-building-a-free-hyper-v-server-2012-cluster-part-1-of-2.aspx •Part 2 - blogs.technet.com/.../building-a-free-hyper-v-server-2012-cluster-part-2-of-2.aspx Please feel free to share these guides broadly with your colleagues and community!   Hope this helps! Keith

  • Anonymous
    January 01, 2003
    Hi Keith if i use storage space for storage such as hyper-v . Do it need to use iscsi target for clustering ? or no ? or  we can leverage Storage Spaces without iscsi target ? Please clear me . i create Storage Spaces and now want use for hyper-v vm but i want all of node can access to data ? i just know i can do it with iscsi target .

  • Anonymous
    March 19, 2013
    Hello Keith,     I actually have this running on a Dell PowerEdge 850 Server. I used the Eval version of Windows Server 2012 and it worked like a champ. I am now using it with building the Hyper-V failover Cluster building from the article you wrote. I was wondering where part 2 of that article is by the way. So I m for one a believer however I can not afford Windows Server 2012 as my solution so I have to go back to Windows 7 pro in 6 months. Just wanted you to know, I am actually writing a how to for a stand alone iSCSI san and a failover san using Windows Server 2012 .... Thanks for the great articles.