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
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:
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
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.
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:
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:
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
2. Select the server you want to enable iSCSI Target
3. Select the iSCSI Target Role:
To enable iSCSI Target feature, you should select the “iSCSI Target Server” feature.
4. Confirm the installation
Using cmdlets
Open the powershell cmdlet window, and run the following cmdlet:
Add-WindowsFeature FS-iSCSITarget-Server
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:
The first wizard link is to create iSCSI Virtual Disk.
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. |
|
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. |
|
Specify the iSCSI virtual disk size. |
|
Now the wizard will guide you to assign the virtual disk to an iSCSI Target. |
|
Give the Target a name. This name will be discovered by the iSCSI initiator, and use for the connection. |
|
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. |
|
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. |
|
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. |
|
Last, the confirmation page. |
Once the wizard is completed, the iSCSI Virtual Disk will be shown on the iSCSI Page.
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:
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.
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.
3. Assign VHD to Target: Add-IscsiVirtualDiskTargetMapping TestTarget2 c:\test\1.vhd
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
Go to the Discovery tab page and click on the Discover Portal. Add the IP address of the iSCSI Target Server. |
|
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. |
|
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. |
|
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
3. Connect:
Connect-IscsiTarget –NodeAddress “iqn.1991-05.com.microsoft:netboot-1-nettarget-target”
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:
Launch the New Volume Wizard, from
Select the disk. Disk 2 is the offline iSCSI virtual disk. |
|
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. |
|
Specifies the volume size. |
|
Assign drive letter |
|
You can create either NTFS or ReFS volume. For more information about ReFS, please see the link |
|
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
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:
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.
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, which is planned to be released for RTM.
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 |
|
Not supported setup |
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.