You are on page 1of 7

Setup Windows Server 2012 R2 as an iSCSI Storage Server

13/03/15

Search this site

Petri

Thurrott

Menu
Home Windows Server Windows Server 2012 Setup Windows Server 2012 R2 as an iSCSI Storage Server

Setup Windows Server 2012 R2 as an iSCSI Storage Server


Posted on December 1, 2014 by Russell Smith in Windows Server 2012 with 0 Comments
In this Ask the Admin, Ill show you how to configure W indows Server 2012 R2 as an iSCSI storage
server array, and how to connect to it from another server.
Sponsored

What is iSCSI?
iSCSI has been around for a long time, and while it might sound like a technology thats only available
in enterprise-grade hardware, its been supported in W indows since Vista. It is also supported by many
Network Attached Storage (NAS) solutions and works over standard Ethernet.
But what is iSCSI? SCSI interfaces have long been used to connect peripherals, mainly hard drives, to
servers. SCSI is favored in server hardware due to the performance benefits it provides over SATA
interfaces found in most consumer PCs. iSCSI allows remote devices to be connected across Ethernet
networks, but appear as if they are attached locally.
Performance is often better than mapping a drive, and iSCSI provides better compatibility with
applications that dont support mapped network drives. Its also a great solution for extending storage
on devices such as notebooks where there is limited expansion capability.
In this demonstration, Im going to set up W indows Server 2012 R2 with two locally attached disks in a
mirrored pair, and then configure the iSCSI Target Server role to make the storage accessible from
another server. Y ou can adapt the instructions for your home or office lab, or use Azure, remembering
that while you will be able to get this working in the cloud, its not a supported scenario for production
systems.
In my Azure lab, I have two servers: CONTOSOSRV1 will serve as the iSCSI storage array, hosting the
iSCSI Target Server role, and CONTOSOSRV2 will use Microsofts iSCSI initiator to connect to the target
server. Im going to use a mirrored volume on CONTOSOSRV1, but a simple volume can also be used if
fault tolerance isnt required.

Install and Configure iSCSI Target Server


Before continuing, you need to attach one or more physical disks to CONTOSOSRV1, bring the disk(s)
online and format a volume on which to provision one or more iSCSI virtual disks. Like in Storage
Spaces, everything is softw are defined, hence the use of virtual disks in the process. For more
http://www.petri.com/setup-windows-server-2012-r2-iscsi-storage-server.htm?utm_source=Newsletter&utm_medium=Email&utm_campaign=ENL%20[Petri]%20-%20Mar,%2013th%20(ID:%20632)1 / 7

Setup Windows Server 2012 R2 as an iSCSI Storage Server

13/03/15

information on attaching disks to an Azure virtual machine, and provisioning a mirrored volume using
Storage Spaces, see Provision a Storage Spaces Mirrored Volume in W indows Server using
PowerShell on the Petri I T Know ledgebase.
Sponsored

Once you have a volume provisioned, install the iSCSI Target Server role on CONTOSOSRV1. Open a
PowerShell console with administrative privileges and run the command below:
1 install-w indow sfeature FS-iSCSITarget-Server includemanagementtools

W ait for the server role to install, and then configure a new iSCSI server target. As part of the process,
we need to specify which devices will be allowed to connect to the target server using the initiatorID
parameter. Replace 10.0.0.5, the IP address for CONTOSOSRV2 in my lab, with the IP address for the
equivalent server in your environment.

Configuring the iSCSI server target. (I mage Credit: Russell Smith)

1 New -IscsiServerTarget TargetName iSCSITarget1 InitiatorID IPAddress:10.0.0.5

Ive specified one server by IP address, but you can specify multiple servers or use DNS names, which
is best practice. For example I PAddress:10.0.0.5,I PAddress:10.0.0.6 or
DNSName:contososrv2,DNSName:contososrv3.
Now lets create an iSCSI virtual disk on our volume, and add it to the server target. Im going to
create one iSCSI virtual disk that uses the maximum available space of my volume (E:), but you could
alternatively create several smaller iSCSI virtual disks.
1 New -IscsiVirtualDisk Path E:\iSCSIVirtualDisks\iSCSIdisk1.vhdx size 50GB
2 Add-IscsiVirtualDiskTargetMapping TargetName iSCSITarget1 DevicePath E:\iSCSIVirtualDisks\iSCSIdisk1.vhdx

Connect to the Target Server using an iSCSI Initiator


The iSCSI target server configuration is now complete, and that only leaves to connect the disk we just
provisioned to CONTOSOSRV2. Log in to CONTOSOSRV2 and open a PowerShell prompt with local
administrative privileges. Set the iSCSI initiator service to start up automatically and start the service.

http://www.petri.com/setup-windows-server-2012-r2-iscsi-storage-server.htm?utm_source=Newsletter&utm_medium=Email&utm_campaign=ENL%20[Petri]%20-%20Mar,%2013th%20(ID:%20632)2 / 7

Setup Windows Server 2012 R2 as an iSCSI Storage Server

13/03/15

Starting the iSCSI initiator service and defining the target portal. (I mage Credit:
Russell Smith)

1 Set-Service Name MSiSCSI StartupType Automatic


2 Start-Service MSiSCSI

Define the iSCSI storage array we created in the previous steps. 10.0.0.10 is the IP address for
CONTOSOSRV1 in my environment. Its also possible to give a DNS name for the TargetPortalAddress
parameter.
1 New -IscsiTargetPortal TargetPortalAddress 10.0.0.10

Now make a connection to the iSCSI server target using the connect-iscsitarget cmdlet, and make it
persistent so that it will survive server reboots:
1 $target = Get-IscsiTarget
2 Connect-IscsiTarget NodeAddress $target.NodeAddress
3 Get-IscsiSession | Register-IscsiSession

Format the new disk discovered by the initiator. (I mage Credit: Russell Smith)

Finally, check that you can see the iSCSI disk connected to CONTOSOSRV2:
1 Get-Disk | W here-Object BusType eq iSCSI

Sponsored

http://www.petri.com/setup-windows-server-2012-r2-iscsi-storage-server.htm?utm_source=Newsletter&utm_medium=Email&utm_campaign=ENL%20[Petri]%20-%20Mar,%2013th%20(ID:%20632)3 / 7

Setup Windows Server 2012 R2 as an iSCSI Storage Server

13/03/15

Prepare the New Disk


Because iSCSI disks behave in the same way as locally attached disks, the new disk needs to be
prepared for use on CONTOSOSRV2 as if it were physically attached.
1 Initialize-Disk Number 2 PartitionStyle GPT PassThru | New -Partition AssignDriveLetter UseMaximumSize | Format-Volume

Tagged Editor's Pick


Sponsored

Share

http://www.petri.com/setup-windows-server-2012-r2-iscsi-storage-server.htm?utm_source=Newsletter&utm_medium=Email&utm_campaign=ENL%20[Petri]%20-%20Mar,%2013th%20(ID:%20632)4 / 7

Setup Windows Server 2012 R2 as an iSCSI Storage Server

13/03/15

Join The Conversation

Sponsors

http://www.petri.com/setup-windows-server-2012-r2-iscsi-storage-server.htm?utm_source=Newsletter&utm_medium=Email&utm_campaign=ENL%20[Petri]%20-%20Mar,%2013th%20(ID:%20632)5 / 7

Setup Windows Server 2012 R2 as an iSCSI Storage Server

Tweet

13/03/15

21

http://www.petri.com/setup-windows-server-2012-r2-iscsi-storage-server.htm?utm_source=Newsletter&utm_medium=Email&utm_campaign=ENL%20[Petri]%20-%20Mar,%2013th%20(ID:%20632)6 / 7

Setup Windows Server 2012 R2 as an iSCSI Storage Server

13/03/15

Founded in 1998 by Daniel Petri, Petri IT Knowledgebase serves as one of


the world's leading IT-related content and community sites and our forums
are a popular online destination for system administrators to network and
exchange information with peers.

Petri Editorial Staff

2014 Petri IT Knowledgebase. All rights reserved.

http://www.petri.com/setup-windows-server-2012-r2-iscsi-storage-server.htm?utm_source=Newsletter&utm_medium=Email&utm_campaign=ENL%20[Petri]%20-%20Mar,%2013th%20(ID:%20632)7 / 7

You might also like