Introduction of iSCSI Target in Windows Server 2012

Introduction of iSCSI Target in Windows Server 2012

  • Comments 15
  • Likes

The iSCSI Target made its debut as a free download for Windows 2008 R2 in April 2011, since then, there were more than 60,000 downloads. That was the first step to make it available for everyone. Now in Windows Server 2012, no more downloads and separate installation; it comes as a build-in feature. This blog will provide step-by-step instructions to enable and configure iSCSI Target.

If you are not familiar with iSCSI Target, it allows your Windows Server to share block storage remotely. iSCSI leverages the Ethernet network and does not require any specialized hardware. In this release we have developed a brand new UI integrated with Server manager, along with 20+ cmdlets for easy management. The following references also provide additional examples/use cases:

Six uses for the Microsoft iSCSI Software Target

Using the Microsoft iSCSI Software Target with Hyper-V

Diskless servers can boot and run from the Microsoft iSCSI Software Target using a regular network card!

Note: the instructions from the above references are for previous release, they are not applicable on Windows Server 2012. Please use the instructions provided in this blog instead.

Overview

There are two features related to iSCSI Target:

· The iSCSI Target Server is the server component which provides the block storage to initiators.

· The iSCSI Target Storage Provider (VDS and VSS) includes 2 components:

o VDS provider

o VSS provider

The diagram below shows how they relate to each other:

image

The providers are for remote Target management. The VDS provider is typically installed on a storage management server, and allows user to manage storage in a central location using VDS. VSS provider is involved when application running on initiator is taking application consistent snapshot. This storage provider works on Windows Server 2012, for version support matrix, please go to the FAQ section.

As it shown on the diagram, the iSCSI Target and Storage providers are enabled on different servers. This blog focuses on the iSCSI Target Server, and will provide instructions for enabling iSCSI Target Server. It is similar in UI to enable the Storage providers, just be sure to enabling it on the application server.

Terminology

image

iSCSI: it is an industry standard protocol allow sharing block storage over the Ethernet. The server shares the storage is called iSCSI Target. The server (machine) consumes the storage is called iSCSI initiator. Typically, the iSCSI initiator is an application server. For example, iSCSI Target provides storage to a SQL server, the SQL server will be the iSCSI initiator in this deployment.

Target: It is an object which allows the iSCSI initiator to make a connection. The Target keeps track of the initiators which are allowed to be connected to it. The Target also keeps track of the iSCSI virtual disks which are associated with it. Once the initiator establishes the connection to the Target, all the iSCSI virtual disks associated with the Target will be accessible by the initiator.

iSCSI Target Server: The server runs the iSCSI Target. It is also the iSCSI Target role name in Windows Server 2012.

iSCSI virtual disk: It also referred to as iSCSI LUN. It is the object which can be mounted by the iSCSI initiator. The iSCSI virtual disk is backed by the VHD file. For the VHD compatibility, refer to FAQs section below.

iSCSI connection: iSCSI initiator makes a connection to the iSCSI Target by logging on to a Target. There could be multiple Targets on the iSCSI Target Server, each Target can be accessed by a defined list of initiators. Multiple initiators can make connections to the same Target. However, this type of configuration is only supported with clustering. Because when multiple initiators connects to the same Target, all the initiators can read/write to the same set of iSCSI virtual disks, if there is no clustering (or equivalent process) to govern the disk access, corruption will occur. With Clustering, only one machine is allowed to access the iSCSI virtual disk at one time.

IQN: It is a unique identifier of the Target or Initiator. The Target IQN is shown when it is created on the Server. The initiator IQN can be found by typing a simple “iscsicli” cmd in the command window.

image

Loopback: There are cases where you want to run the initiator and Target on the same machine; it is referred as “loopback”. In Windows Server 2012, it is a supported configuration. In loopback configuration, you can provide the local machine name to the initiator for discovery, and it will list all the Targets which the initiator can connect to. Once connected, the iSCSI virtual disk will be presented to the local machine as a new disk mounted. There will be performance impact to the IO, since it will travel through the iSCSI initiator and Target software stack when comparing to other local IOs. One use case of this configuration is to have initiators writing data to the iSCSI virtual disk, then mount those disks on the Target server (using loopback) to check the data in read mode.

 

iSCSI Target management overview

Using Server Manager

iSCSI Target can be managed by the UI through Server Manager, or cmdlets. With Server Manager, a new iSCSI page will be displayed, as follow:

clip_image008

All the iSCSI virtual disk, Target management can be done through this page.

Note: iSCSI initiator UI management is done by the initiator control panel, which can be launched through Server Manager:

image

Using cmdlets

Cmdlets are grouped in modules. To get all the cmdlets in a module, you can type

Get-command –module <modulename>

iSCSI Target cmdlets: -module iSCSITarget

iSCSI initiator cmdlets: -module iSCSI

Volume, partition, disk, Storage pool and related cmdlets: -module storage

To use iSCSI Target end to end, cmdlets from all three modules will be used as illustrated in the examples below.

Enable iSCSI Target

Using Server Manager (UI)

iSCSI Target can be enabled using Add roles and features in the Server Manager:

1. Choose the Role-based or feature-based installation option

clip_image013

2. Select the server you want to enable iSCSI Target

clip_image015

3. Select the iSCSI Target Role:

image

To enable iSCSI Target feature, you should select the “iSCSI Target Server” feature.

4. Confirm the installation

clip_image020

Using cmdlets

Open the powershell cmdlet window, and run the following cmdlet:

Add-WindowsFeature FS-iSCSITarget-Server

clip_image022

Configuration

Create iSCSI LUN

To share storage, the first thing is to create an iSCSI LUN (aka. iSCSI virtual disk). The iSCSI virtual disk is backed by a VHD file.

Using Server Manager

Once the iSCSI Target role is enabled, Server Manager will have an iSCSI page:

image

The first wizard link is to create iSCSI Virtual Disk.

clip_image027

Since Server Manager allows for multi machine management, the UI is built to support that. If you have multiple servers in the management pool, you can create iSCSI Virtual disk on any servers with iSCSI Target enabled from one management UI.

clip_image029

The UI also pre-populates the Path to “iSCSIVirtualDisks” by default. If you want to use a different one, go to the previous page, and select “Type a custom path”. If the path doesn’t exist, it will be created.

clip_image031

Specify the iSCSI virtual disk size.

clip_image033

Now the wizard will guide you to assign the virtual disk to an iSCSI Target.

clip_image035

Give the Target a name. This name will be discovered by the iSCSI initiator, and use for the connection.

clip_image037

This page allows you to specify the initiators which can access the virtual disk, by allowing the Target to be discovered by defined list of initiators.

Clustering: You can configure multiple initiators to access the same virtual disk by adding more initiators to the list. To add the initiators, click on the Add button.

clip_image039

The wizard is designed to simplify the assignment using the server name. By default, it is recommended to use IQN. The IQN is typically long, so the wizard will be able to resolve the computer name to IQN if the computer is Windows Server 2012. If the initiator is running previous Windows OS, you can also find the IQNs as described in the Terminology section.

clip_image041

CHAP is an authentication mechanism defined by the iSCSI standard to secure access to the target. It allows the initiator to authenticate to the Target, and in reverse allowing the Target to authenticate against the initiator.

Note: You cannot retrieve the CHAP information once it is set. If you lose the CHAP information, it will need to be set again.

clip_image043

Last, the confirmation page.

Once the wizard is completed, the iSCSI Virtual Disk will be shown on the iSCSI Page.

clip_image045

If you want to find all the iSCSI Virtual disks hosted on a volume, one simple way of doing this is to go to the Volume page, and select the volume. All the iSCSI virtual disks on that volume will be shown on the page:

image

Using Cmdlet

Same configuration can also be automated using the cmdlet.

1. LUN creation: New-IscsiVirtualDisk c:\test\1.vhd –size 1GB

First parameter is the VHD file path. The file name must not exist. If you want to load an existing VHD file, use Import-IscsiVirtualDisk command. The –size parameter specifies the size of the VHD file.

clip_image051

2. Target creation: New-IscsiServerTarget TestTarget2 –InitiatorIds “IQN: iqn.1991-05.com.Microsoft:VM1.contoso.com”

The first parameter is the Target name, and the –InitiatorIds stores the initiators which can connect to the Target.

clip_image053

3. Assign VHD to Target: Add-IscsiVirtualDiskTargetMapping TestTarget2 c:\test\1.vhd

clip_image054

Configure iSCSI initiator to logon the Target

Once the iSCSI Virtual disk is created and assigned, it is ready for the initiator to logon.

Typically, the iSCSI initiator and iSCSI Target are on different machines (physical or virtual). You will need to provide the iSCSI Target server IP or host name to the initiator, and the initiator will be able to do a discovery of the iSCSI Target. All the Targets which can be accessed will be presented to the initiator. If you cannot find the Target name, check

1. The Target Server IP or hostname which was given to the initiator

2. The initiator IQN which assigned to the Target object. It is very common to have a typo in this field. One trick to verify this, is to assign the Target with “IQN:*”, which means any initiator can access this Target. It is not a recommended practice, but a good troubleshooting technique.

3. Network connectivity between initiator and Target machine.

Using UI

Launch the iSCSI initiator Properties from Server Manager -> Tools

image

image 

Go to the Discovery tab page and click on the Discover Portal.

Add the IP address of the iSCSI Target Server.

clip_image061

After discovery, all the Targets from the Server will be listed in the “Discovered Targets” box.

Select the one you want to connect, and click on Connect. This will allow the initiator to connect to the target and access associated disks.

image 

Connect button will launch a “Connect to Target” dialog box. If target is not configure with CHAP, you can simply click “OK” to connect.

To specify CHAP information, click on the Advanced button.

Check the “Enable CHAP log on” box, and provide the CHAP information.

Advanced configuration by specify IPs for iSCSI connection: If you want to dedicate iSCSI traffic to a specific set of the NICs, you can specify that in the “Connect using”. By default, any IPs can be used for iSCSI connection.

Note if a specific IP is configured, and the IP address changed due to DHCP, the iSCSI initiator will not be able to reconnect after reboot. You will need to change the IP on this page, then connect.

clip_image066

Connection established.

Using Cmdlet

By default iSCSI initiator service is not started, the cmdlet will not work. If you launch the iSCSI initiator from the control panel, it will prompt for service start, as well as setting the service to start automatically.

For the equivalent using the cmdlet, you need to run

Start-Service msiscsi

Set-Service msiscsi –StartupType “Automatic”

1. Specify the iSCSI Target Server name:

New-IscsiTargetPortal –TargetPortalAddress Netboot-1

 

This is similar to the discovery in the UI.

2. Get the available Targets (this is optional):

Get-IscsiTarget

 

clip_image068

3. Connect:

Connect-IscsiTarget –NodeAddress “iqn.1991-05.com.microsoft:netboot-1-nettarget-target”

 

image

If you want to connect all the Targets, you can also type:

Get-IscsiTarget | Connect-IscsiTarget

4. Register the Target as Favorite target, so that, it will reconnect upon initiator machine reboot.

Register-IscsiSession -SessionIdentifier "fffffa8004146020-4000013700000007"

You can get the sessionIdentifier from output of Connect-IscsiTarget, or Get-IscsiSession

Create new volume

Once the connection is established, the iSCSI virtual disk will be presented to the initiator as a disk. By default, this disk will be offline,. For typical usage, you want to create a volume, format the volume and assign with a drive letter so it can be used just like a local hard disk.

Using Server Manager

You can right click on the disk to bring it online, but it is not necessary. If you run the new volume wizard, it will be brought online automatically.

From Server Manager->File and Storage Services->Volumes->Disks page, check the disk 2 is in offline mode:

clip_image073

Launch the New Volume Wizard, from

image

clip_image078

Select the disk.

Disk 2 is the offline iSCSI virtual disk.

clip_image080

UI will bring the disk online, and initialize it to GPT. GPT is preferred, for more information, see here. If you have specific reasons creating MBR partition, you will need to use the cmdlet.

clip_image082

Specifies the volume size.

clip_image084

Assign drive letter

clip_image086 

You can create either NTFS or ReFS volume. For more information about ReFS, please see the link

clip_image088

Confirmation page to create the new volume

Using cmdlet

The following cmdlets are provided by the Storage module:

1. Check if the initiator can see the disk: Get-disk

image

2. Bring disk 3 online:

Set-disk –number 3 –IsOffline 0

3. Make disk 3 writable:

Set-disk –number 3 –isReadOnly 0

4. Initialize the disk 3:

Initialize-Disk -Number 3 -PartitionStyle MBR

5. Create a partition on disk 3 (To avoid a format volume popup in Windows Explorer, let’s not assign a drive letter at this time. We will do that after the volume is formatted)

New-Partition -DiskNumber 3 -UseMaximumSize -AssignDriveLetter:$False

6. Format volume:

Get-Partition –DiskNumber 3 | Format-Volume

7. Assign the drive letter now:

Get-Partition –DiskNumber 3 | Add-PartitionAccessPath –AssignDriveLetter:$true

FAQs

If you have used previous release of the iSCSI Target, the most noticeable change in Window Server 2012 is the user experience. Some common questions are:

1. Installing the web download of iSCSI Target for Windows Server 2008 R2 on Windows Server 2012.

The installation might succeed, but you won’t be able to configure it. You need to uninstall the download, and enable the inbox iSCSI Target.

2. Trying to manage the iSCSI Target with the MMC snapin

The new UI is integrated with Server Manager. Once the feature is enabled, you can manage the iSCSI Target from the “iSCSI” tab page. Server Manager\File and Storage Services\iSCSI

3. How to get all the cmdlet for iSCSI Target?

Type “get-command –module iscsiTarget” . The list shows all the cmdlets to manage the iSCSI Target.

4. Running the cmdlet scripts developed using the previous release

Although most of the cmdlets do work, there are changes to the parameters which may not be compatible. If you run into issues with the cmdlets developed from the previous release, please run the get-help cmdname to verify the parameter settings.

5. Running the WMI scripts developed using the previous release

Although most of the WMI classes are unchanged, some changes are not backward compatible. If you run into issues with the cmdlets developed from the previous release, please check the WMI classes and its parameters.

6. SMI-S support

iSCSI Target doesn’t have the SMI-S support in Windows Server 2012.

7. VHD compatibility

iSCSI virtual disk stores data in a VHD file. This VHD file is compatible with Hyper-V, i.e. you can load this VHD file using either iSCSI or Hyper-V. Hyper-V in Windows Server 2012 has introduced a new virtual hard disk format VHDx, which is not supported by iSCSI Target. Refer the table below for more details:

 

image

8. Cmdlet help

If you have any questions about the cmdlet, type “get-help cmdletname” to learn the usage. Before you can use get-help, you need to run “Update-help –module iscsTarget”, this allows the help content to be downloaded to your machine. Of course, this also implies you will need internet connectivity to get the content. This is a new publishing model of the help content, which allows for dynamic update of the content.

9. Storage Provider and iSCSI Target Version interop matrix

iSCSI Target has made a few releases in the past, below shows the version numbers and the supported OS it runs on.

iSCSI Target 3.2 <-> Windows Storage Server 2008

iSCSI Target 3.3 <-> Windows Storage Server 2008 R2 and Windows Server 2008 R2

iSCSI Target (build-in) <-> Windows Server 2012

For each Target release, there is a corresponding storage provider package, which allows the remote management. The table below shows the interop matrix.

image

 

Note:

1: Storage provider 3.3 on Server 2012 can manage iSCSI Target 3.2. This has been tested.

2: the 2012 Downlevel storage provider is a web download, you can find the download package here.

10. Does iSCSI Target support Storage spaces?

Storage space is a new feature in Windows 8 and Windows Server 2012, which provides storage availability and resiliency with commodity hardware. You can find more information about the Storage Spaces feature here. Hosting iSCSI virtual disks on Storage Spaces is supported.  Using iSCSI LUNs in a Storage Spaces pool is not supported. Below is a topology diagram to illustrate the two scenarios:

Supported setup

image 

Not supported setup

image 

11. CSV supports

iSCSI Target doesn't support VHDs hosted on CSVs (Cluster shared volumes).

Conclusion

I hope this helps you get started using the iSCSI Target in Windows Server 2012, or make a smoother transition from the previous user experience. This blog only covers the most basic configurations. If you have questions not covered, please raise it in the comments, so I can address it with upcoming postings.

Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment
  • Are there any known issues with IMPORTING a VHD file into the iSCSI Target that was created on a previous version of Hyper-V, e.g. 2008 R2? When I try to import a VHD file that was a being used on a 2008 R2 Hyper-V server, I get the message "Unexpected error has occurred."  The message appears both in the GUI and in the PowerShell output.  I can mount the VHD file on the iSCSI Target server, but cannot IMPORT it.  The server can create new iSCSI disks without issue.

    Excellent post by the way.

  • Can you tell me the type of VHD you created by R2 Hyper-V Server? I suspect you are importing dynamic VHD.

    iSCSI Target supports importing fixed and differencing VHD from R2 Hyper-V. Dynamic VHDs are not supported by iSCSI Target.

    When importing differencing VHDs, you need to do a convert-IscsiVirtualDisk to make it 4K aligned. After the conversion, you can successfully import the converted VHD.

  • Jane, I'm setting up a lab environment and I have server setup with Windows Server 2012, there are two physical disks. One is 145gb where the OS lives and second is 2TB. In the iSCSI mgmt window I don't see my second disk. Both disks are SATA disks, both are formatted, I can browse to both through the Explorer. Yesterday I noted that the 2TB disk was showing as Disk 0, thinking maybe there was something that would prevent that from working, I moved the disk to a different controller, it's now showing as Disk 1. I'm still unable to create a LUN, the only drive that shows is C:

    Additionally if i create a mountpoint C:\Storage that points to my 2TB disk, i'm still only able to a make disk that is as large as the free space on C:.

  • Oh, and I should have led off with this...Wonderful Post!!! Thanks

  • Jeffrey, there are a few things you can try:

    1. If you run get-disk from powershell cmd window, do you get both disks?

    2. What file system do you formatted to for the 2TB drive?

    3. If you run new-iscsivirtualdisk <path> -size 1GB, where path points to the 2TB drive, what do you get in return? this is to try create a small VHD on the 2TB drive, I'd like to see if it is a volume iSCSI target support.

  • Thanks for sharing, excellent post!

  • Jane, you were correct as the VHD was a dynamically expanding disk.  Once I used a fixed disk, all worked fine!  Thanks for the help!

  • Excellent post - many thanks.

    We got a bit confused setting when adding the Initator ID. If you add an IP address should it be the address of the server that's hosting the target, or the address of the initiator that's going to connect to it?

    And btw, the Terminology link is a pointing to a sharepoint document that doesn't have public access.

  • @Keith, Thanks for the comment. I fixed the FAQ link. It refers the FAQ at the bottom of the post.

    Regarding to the Initiator ID, it is the initiator identification for the Target object to know. That identification can be IP, DNS name, IQN or MAC. If you choose IP, it will be the initiator IP. During initiator Login, the Target will assess, if this IP belongs to the initiator which allows for access.

    You will provide the Target IP on the initiator machine, for discovery purpose. Such as add-IscsiTargetPortal.

  • Hi

    I have issues while importing the VHD ( Created using Server 2012 ). Error - Unexpected Error occured

  • @RK, can you be more specific about the issue you run into? How did you create the VHD? how are you importing it? Is there any eventlog entries in the eventvwr? What version of the builds are you using?

    Importing VHD is a basic function of iSCSI Target, I have tried it on various Server 2012 builds, and didn't hit the error you encountered. I'm trying to find out what's different on your system.

  • This is the most complete and excellent article on 2012 iSCSI support. Thanks you very much.

  • I agree with Dave, thank you very much.