Creating iSCSI virtual disks
Once you finish installing the iSCSI Target Server role
service using the Add Roles And Feature Wizard, the message in the
iSCSI Virtual Disks tile on the iSCSI page of Server Manager changes
to indicate that you can now create an iSCSI virtual disk. (See
Figure 5.)
Creating iSCSI virtual disks is the first step in provisioning iSCSI
storage to applications that require or can use block
storage.
You can create a new iSCSI virtual disk using either Server
Manager or Windows PowerShell. To create a new iSCSI virtual disk
using Server Manager, do any of the following:
-
Click the message in the iSCSI Virtual Disks tile on the
iSCSI page.
-
Select New iSCSI Virtual Disk from the Tasks menu of this
iSCSI Virtual Disks tile on the iSCSI page.
-
Right-click on any NTFS volume in the Volumes tile on the
Disks page or the Volumes page and select New iSCSI Virtual
Disk.
Performing any of these actions will launch the New iSCSI
Virtual Disk Wizard, which you can use to create your new iSCSI
virtual disk as follows:
-
On the Select iSCSI Virtual Disk Location page, begin by
selecting a target server. The list of available servers are
those that Server Manager has determined that the iSCSI Target
Server role has been installed on.
-
After you select an iSCSI Target server, select an
NTFS-formatted volume on the server that has sufficient free
space to host your new iSCSI virtual disk:
-
In the preceding screen shot, volume X on server HOST7 is
selected for hosting the new iSCSI virtual disk. The new disk
will be backed by a VHD file that will be stored in a folder
named iSCSIVirtualDisks in the root of X drive.
-
On the Specify iSCSI Virtual Disk Name page, type a name
and optional description for the new iSCSI virtual disk. For
example, if you name the disk “Database,” a file named
Database.vhd will be created in the location
X:\iSCSIVirtualDisks on HOST7. This VHD file will be used to
back the new iSCSI virtual disk you are creating.
-
On the Specify iSCSI Virtual Disk Size page, specify a
size for the new iSCSI virtual disk. The maximum possible size
of the disk depends on the amount of free space available on the
selected volume.
-
On the Assign iSCSI Target page, select New iSCSI Target
because this is the first iSCSI virtual disk you are creating.
You can also assign the new disk to an existing target if any
already exist in your environment.
-
On the Specify Target Name page, type a name and optional
description for the new target:
-
On the Specify Access Servers page, click Add to specify
the iSCSI initiator that will access your iSCSI virtual disk.
Doing this opens the Add Initiator ID dialog box, which provides
three ways of identifying iSCSI initiators:
-
By querying a computer on which the iSCSI initiator
has been enabled for its Initiator ID. This method is
supported only in Windows Server 2012 and Windows 8.
-
By selecting an available Initiator ID from the list
of cached IDs on the Target server. This method works only
if there are entries in the initiator cache on the Target
server.
-
By manually specifying the IQN for the
initiator.
For example, let’s say that the initiator computer is a
server named HOST4 that is running Windows Server 2012. To query
for the Initiator ID on HOST4, select the first option in the
preceding list and either type HOST4 or click Browse to search Active
Directory for the initiator computer, and then click OK to
return to the Specify Access Servers page of the New iSCSI
Virtual Disk Wizard. At this point, the IQN for the initiator
will be displayed as shown here:
Note
Allowing any initiator to connect to the target
If you want to allow any iSCSI initiator to connect to
the target, select the third option on the Specify Access
Servers page and type IQN:* as
the initiator IQN.
-
On the Enable Authentication page, you can optionally
enable one or both of the following authentication
protocols:
-
CHAP The Challenge
Handshake Authentication Protocol (CHAP) protocol can be
used to authenticate initiator connections.
-
Reverse CHAP This
protocol can be used to allow the initiator to authenticate
the iSCSI target.
-
If you enable either of these protocols, you must specify
a user name and password for each of them.
At this point, you should review the information on the
Confirm Selections page to make sure you don’t need to change
anything. Once you are satisfied, click Create to create the new
iSCSI virtual disk, create the target (if needed), and assign the
disk to the target.
After you create your iSCSI virtual disk and target, you can
view and manage them on the iSCSI subpage of the File And Storage
Services page of Server Manager as shown in Figure 6.
You can also use Windows PowerShell to create new iSCSI
virtual disks and iSCSI targets, and to assign iSCSI virtual disks
to targets. For example, you can begin by opening a Windows
PowerShell console on the iSCSI Target server HOST7 and using the
Get-IscsiVirtualDisk cmdlet to display a list of existing iSCSI
virtual disks on the server:
PS C:\> Get-IscsiVirtualDisk
ClusterGroupName :
ComputerName : HOST7.corp.fabrikam.com
Description : iSCSI virtual disk for Fabrikam database server
DiskType : Fixed
HostVolumeId : {DD1FDED1-3C51-4A33-850A-23C06A555FE5}
LocalMountDeviceId :
OriginalPath :
ParentPath :
Path : X:\iSCSIVirtualDisks\Database.vhd
SerialNumber : C9EACA53-B17D-4BCF-836B-9EF16867B866
Size : 161061273600
SnapshotIds :
Status : NotConnected
VirtualDiskIndex : 1795469856
Note that the value of the Path property
in the preceding command output is what you would expect based on
what you saw earlier in the iSCSI Virtual Disks tile in Figure 6.
Now let’s use the New-IscsiVirtualDisk cmdlet to create a new
iSCSI virtual disk that is 50 GBs in size and is backed by a file
named data.vhd:
PS C:\> New-IscsiVirtualDisk -Path X:\iSCSIVirtualDisks\data.vhd -Size 50GB
ClusterGroupName :
ComputerName : HOST7.corp.fabrikam.com
Description :
DiskType : Fixed
HostVolumeId : {DD1FDED1-3C51-4A33-850A-23C06A555FE5}
LocalMountDeviceId :
OriginalPath :
ParentPath :
Path : X:\iSCSIVirtualDisks\data.vhd
SerialNumber : A6403147-E3E0-433E-88B4-403549244CB4
Size : 53687091200
SnapshotIds :
Status : NotConnected
VirtualDiskIndex : 1884425455
Now you can either assign this new iSCSI virtual disk to the
existing target you created earlier using Server Manager, or you can
create a new target and assign the disk to it. Let’s choose the
second approach, but first let’s use the Get-IscsiServerTarget
cmdlet to display a list of targets on the iSCSI Target
server:
PS C:\> Get-IscsiServerTarget
ChapUserName :
ClusterGroupName :
ComputerName : HOST7.corp.fabrikam.com
Description : iSCSI target for use by Fabrikam database server
EnableChap : False
EnableReverseChap : False
EnforceIdleTimeoutDetection : True
FirstBurstLength : 65536
IdleDuration : 00:15:00
InitiatorIds : {Iqn:iqn.1991-05.com.microsoft:host4.corp.fabrikam.com}
LastLogin :
LunMappings : {TargetName:fabrikam-db;VHD:"X:\iSCSIVirtualDisks\
Database.vhd";LUN:0}
MaxBurstLength : 262144
MaxReceiveDataSegmentLength : 65536
ReceiveBufferCount : 10
ReverseChapUserName :
Sessions : {}
Status : NotConnected
TargetIqn : iqn.1991-05.com.microsoft:host7-fabrikam-db-target
TargetName : fabrikam-db
Note that the value of the TargetName
property in the preceding command output is what you would expect
based on what you saw earlier in the iSCSI Targets tile in Figure 6.
Now use the New-IscsiServerTarget cmdlet to create a new
target named “fabrikam-data” that will use the same Initiator ID
used by our existing fabrikam-db target:
PS C:\> New-IscsiServerTarget -TargetName fabrikam-data `
-InitiatorIds "IQN:iqn.1991-05.com.microsoft:host4.corp.fabrikam.com"
ChapUserName :
ClusterGroupName :
ComputerName : HOST7.corp.fabrikam.com
Description :
EnableChap : False
EnableReverseChap : False
EnforceIdleTimeoutDetection : True
FirstBurstLength : 65536
IdleDuration : 00:00:00
InitiatorIds : {Iqn:iqn.1991-05.com.microsoft:host4.corp.fabrikam.com}
LastLogin :
LunMappings : {}
MaxBurstLength : 262144
MaxReceiveDataSegmentLength : 65536
ReceiveBufferCount : 10
ReverseChapUserName :
Sessions : {}
Status : NotConnected
TargetIqn : iqn.1991-05.com.microsoft:host7-fabrikam-data-target
TargetName : fabrikam-data
Note that the LunMappings property in the
preceding command indicates that no iSCSI virtual disks have been
assigned to this target yet. You can assign your data.vhd virtual
disk to your fabrikam-data target by using the
Add-IscsiVirtualDiskTargetMapping cmdlet like this:
PS C:\> Add-IscsiVirtualDiskTargetMapping -TargetName fabrikam-data `
-Path X:\iSCSIVirtualDisks\data.vhd
Finally, to verify that the mapping was created, you can use
the Get-IScsiServerTarget cmdlet again, like this:
PS C:\> Get-IscsiServerTarget -TargetName fabrikam-data | fl LunMappings
LunMappings: {TargetName:fabrikam-data;VHD:"X:\iSCSIVirtualDisks\data.vhd";LUN:0}