18 Mar 2013

Configuring iSCSI Storage #3

SRV-A is our application server, that is, the server that consumes the storage. In the previous article of this series we enabled the iSCSI initiator on this server. Recall that the iSCSI initiator is a client service running on a computer that enables users or applications to consume iSCSI storage on a target server. Windows Server 2012 has a built-in feature called (appropriately enough) iSCSI Initiator, which provides iSCSI client functionality by means of a Windows service called the Microsoft iSCSI Service.

SRV-B on the other hand is our storage server, that is, the server that provides block-based storage to the application server. In the previous article we made SRV-B an iSCSI target server by installing a role service called iSCSI Target Server. This role service can be installed either using Server Manager or by using the Install-WindowsFeature cmdlet of Windows PowerShell. For our test environment, SRV-B has direct-attached storage (DAS) in the form of four SATA drives attached to a hardware RAID adapter that uses a SAS bus connection. The RAID adapter has been configured to expose the drives as individual physical disks, that is, no striping, mirroring, or parity has been configured. One of these drives hosts the operating system, while the other three drives (our data drives) have yet to be brought online.

Image
Test scenario used for this walkthrough.

Note:
Other names commonly used for iSCSI target servers are target servers, target portals, or portals.

Before we can provision iSCSI virtual disks on SRV-B, we first need to bring our three data drives online and create NTFS volumes on them. We could use the Disk Management snap-in of Computer Management to do this, but we're not going to do this because beginning with Windows Server 2012 the Disk Management snap-in is now considered deprecated. For more information about this, see this link.

Because of this, we'll instead use the File And Storage Services canvas of Server Manager to bring our three data drives online and create NTFS volumes on them. Begin by selecting the Disks page to display a list of the physical disks attached to SRV-B. Then right-click on each of the three data drives (indicated as Offline) and select Bring Online as shown here:

Image
Bringing the three data drives online.

Once all three data drives are online, right-click on each of them in turn and select New Volume as shown here:

Image
Creating a new volume on a data drive.

Proceed through the New Volume Wizard as shown below, formatting the volumes with NTFS and assigning X, Y and Z as their drive letters and DATA-1, DATA-2 and DATA-3 as their volume labels respectively:

Image

Using the New Volume Wizard to create an NTFS volume on each data drive.

Once you've completed these steps, the three new NTFS volumes should be displayed on the Volumes page of the File And Storage Services canvas as shown here:

Image
The three data drives each have NTFS volumes.

Provisioning iSCSI virtual disks using Server Manager

Now that SRV-B has been configured as the target server and its direct-attached storage has been formatted, we are ready to create virtual disks. A virtual disk behaves like a physical disk but has greater flexibility and scalability because it represents virtual storage instead of physical storage. Virtual disks are also commonly called logical unit numbers or LUNs, and you can think of a LUN as a collection of physical disks that are managed together as a single virtual unit of storage. Before you can create volumes on an iSCSI storage device, you first have to create iSCSI virtual disks. Once you've created an iSCSI virtual disk, you can then create one or more iSCSI volumes on that disk.

We'll start by creating an iSCSI virtual disk on SRV-B using Server Manager. Start by selecting New iSCSI Virtual Disk from the Tasks menu of the iSCSI Virtual Disk tile on the iSCSI page of the File And Storage Services canvas of Server Manager:

Image
Step 1 of creating a new iSCSI virtual disk using Server Manager.

Select the NTFS volume (here X: drive) on which we want to create the new iSCSI virtual disk:

Image

Step 2 of creating a new iSCSI virtual disk using Server Manager.

Type a name and optional description for the new iSCSI virtual disk:

Image

Step 3 of creating a new iSCSI virtual disk using Server Manager.

Note that the new iSCSI virtual disk we are creating will be backed by a VHD file located in a folder named iSCSIVirtualDisks in the root of the NTFS volume we selected.

Specify the size for the new iSCSI virtual disk:

Image

Step 4 of creating a new iSCSI virtual disk using Server Manager.

We've left some free space on the NTFS volume so we can create a second iSCSI virtual disk later on using Windows PowerShell.

Now since this is the first iSCSI virtual disk we're creating on our target server, there are no existing iSCSI targets on the server so we need to create a new target:

Step 5 of creating a new iSCSI virtual disk using Server Manager.

Let's pause for some terminology. If you recall, an iSCSI target server is a server or a storage device (like an iSCSI SAN) that can be used to provision iSCSI storage for your network. An iSCSI target on the other hand is a kind of object you create on a target server. The target allows iSCSI initiators to establish connections with iSCSI virtual disks on the target server. Be sure you understand the difference between targets and target servers. Specifically:

  • Each target server can have one or more targets.
  • Each target can be assigned to one or more virtual disks.
  • Each target can manage one or more connections from initiators.
  • Each initiator can connect to one or more targets and therefore to one or more virtual disks.

Since we're creating a new target on the target server, we need to give our new target a name and optional description:

Image

Step 6 of creating a new iSCSI virtual disk using Server Manager.

Next we need to specify which iSCSI initiators can access the iSCSI virtual disk associated with our new target. You do this by clicking Add on the Access Servers page of the wizard:

Image

Step 7 of creating a new iSCSI virtual disk using Server Manager.

The Add Initiator ID dialog that opens allows you to specify the initiator that will access our new iSCSI virtual disk in three ways. The first way we can specify the initiator is by typing the name of the server on which the initiator resides or browsing Active Directory to select the server. This is what I did in the next screenshot, but note that this only works for initiators on computers running Windows 8 or Windows Server 2012:

Image
Step 8 of creating a new iSCSI virtual disk using Server Manager.

The second way we can specify the initiator is if it is listed in the list of cached initiators on the target server. But since this is the first iSCSI virtual disk we're creating, there are not yet any cached initiators.

The third way we can specify the initiator is by manually identifying the initiator by either its IQN, DNS name, IP address or MAC address.

Time to pause again for some terminology. IQN sands for iSCSI Qualified Name and is is a unique identifier for either a target or initiator. An initiator IQN has the following form:

iqn.1991-05.com.microsoft:<FQDN_of_ initiator_server>

Similarly, a target IQN has the following form:

iqn.1991-05.com.microsoft:<name_of_target_server>-<name_of_target>-target

In this walkthrough, our initiator IQN would be iqn.1991-05.com.microsoft:SRV-A.adatum.com and our target IQN would be iqn.1991-05.com.microsoft:SRV-B-target1-target. As you can see from the next screenshot, clicking OK in the Add Initiator ID dialog above results in the initiator IQN being displayed in the wizard:

Image

Step 9 of creating a new iSCSI virtual disk using Server Manager.

The next wizard page lets us enable CHAP and/or Reverse CHAP for authenticating initiator connections. If you enable one or both of these protocols, you must specify a username and password for them:

Image

Step 10 of creating a new iSCSI virtual disk using Server Manager.

The Confirmation page summarizes all the selections we've made in the wizard:

Image

Step 11 of creating a new iSCSI virtual disk using Server Manager.

Clicking Create causes the new iSCSI virtual disk to be created and assigned to the target:

Image

Step 12 of creating a new iSCSI virtual disk using Server Manager.

As you can see from the next screenshot, the iSCSI page of the File And Storage Services canvas in Server Manager now displays the new iSCSI virtual disk and target we created:

Image
A new iSCSI virtual disk and iSCSI target has been created.

Provisioning iSCSI virtual disks using Windows PowerShell

Let's now create a second iSCSI virtual disk and target by using Windows PowerShell. First, we'll use the New-IscsiVirtualDisk cmdlet to create a new iSCSI virtual disk of size 50 GB on X: drive and back the virtual disk with a VHD file named vdisk2.vhd:

PS C:\> New-IscsiVirtualDisk -Path X:\iSCSIVirtualDisks\vdisk2.vhd -Size 50GB

ClusterGroupName   :
ComputerName       : SRV-B.adatum.com
Description        :
DiskType           : Fixed
HostVolumeId       : {D91E8D49-D764-48B9-8C8D-CE3C3B09BE72}
LocalMountDeviceId :
OriginalPath       :
ParentPath         :
Path               : X:\iSCSIVirtualDisks\vdisk2.vhd
SerialNumber       : E0DB8D1A-C0D5-4BCA-98A6-A4B90A34A4DE
Size               : 53687091200
SnapshotIds        :
Status             : NotConnected
VirtualDiskIndex   : 102487482

Next, we'll use the New-IscsiServerTarget cmdlet to create a new target named "target2" for the initiator on SRV-A:

PS C:\> New-IscsiServerTarget -TargetName target2 -InitiatorIds "IQN:iqn.1991-05.com.microsoft:SRV-A.adatum.com"

ChapUserName                :
ClusterGroupName            :
ComputerName                : SRV-B.adatum.com
Description                 :
EnableChap                  : False
EnableReverseChap           : False
EnforceIdleTimeoutDetection : True
FirstBurstLength            : 65536
IdleDuration                : 00:00:00
InitiatorIds                : {Iqn:iqn.1991-05.com.microsoft:srv-a.adatum.com}
LastLogin                   :
LunMappings                 : {}
MaxBurstLength              : 262144
MaxReceiveDataSegmentLength : 65536
ReceiveBufferCount          : 10
ReverseChapUserName         :
Sessions                    : {}
Status                      : NotConnected
TargetIqn                   : iqn.1991-05.com.microsoft:srv-b-target2-target
TargetName                  : target2

Note that the LunMappings property for the new target has no value, which means an iSCSI virtual disk (that is, a LUN) has not yet been assigned to the target. To assign our new virtual disk to the new target we can use the -IscsiVirtualDiskTargetMapping cmdlet like this:

PS C:\> Add-IscsiVirtualDiskTargetMapping -TargetName target2 -Path X:\iSCSIVirtualDisks\vdisk2.vhd

We're finished. Let's use the Get-IscsiVirtualDisk cmdlet to list all the virtual disks on our target server by filename and path:

PS C:\> Get-IscsiVirtualDisk | fl Path

Path : X:\iSCSIVirtualDisks\vdisk2.vhd

Path : X:\iSCSIVirtualDisks\vdisk1.vhd

And let's use the Get-IscsiServerTarget cmdlet to list all the targets on our target server along with the virtual disks (LUNs) these targets are assigned to:

PS C:\> Get-IscsiServerTarget | fl TargetName,LunMappings

TargetName  : target1
LunMappings : {TargetName:target1;VHD:"X:\iSCSIVirtualDisks\vdisk1.vhd";LUN:0}

TargetName  : target2
LunMappings : {TargetName:target2;VHD:"X:\iSCSIVirtualDisks\vdisk2.vhd";LUN:0}

No comments:

Post a Comment