Setup Windows Server 2012 R2 as an iSCSI Storage Server
In this Ask the Admin, I’ll show you how to configure Windows Server 2012 R2 as an iSCSI storage server array, and how to connect to it from another server.
What is iSCSI?
iSCSI has been around for a long time, and while it might sound like a technology that’s only available in enterprise-grade hardware, it’s bee
n supported in Windows 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 don’t support mapped network drives. It’s also a great solution for extending storage on devices such as notebooks where there is limited expansion capability.
In this demonstration, I’m going to set up Windows 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. You 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, it’s 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 Microsoft’s iSCSI initiator to connect to the target server. I’m going to use a mirrored volume on CONTOSOSRV1, but a simple volume can also be used if fault tolerance isn’t 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 software defined, hence the use of virtual disks in the process. For more 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 Windows Server using PowerShell on the Petri IT Knowledgebase.
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:
Wait 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.
I've specified one server by IP address, but you can specify multiple servers or use DNS names, which is best practice. For example "IPAddress:10.0.0.5,IPAddress:10.0.0.6" or "DNSName:contososrv2,DNSName:contososrv3". Now let's create an iSCSI virtual disk on our volume, and add it to the server target. I'm 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.
“E:\iSCSIVirtualDisks\iSCSIdisk1.vhdx” –size 50GB 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.
Define the iSCSI storage array we created in the previous steps. 10.0.0.10 is the IP address for CONTOSOSRV1 in my environment. It's also possible to give a DNS name for the –TargetPortalAddress parameter.
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:
Finally, check that you can see the iSCSI disk connected to CONTOSOSRV2:
Prepare the New DiskBecause 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.
More in Windows Server 2012
Microsoft Acknowledges New Netlogon Issues On Windows Server Machines
Feb 25, 2022 | Rabia Noureen
How to Fully Patch the PrintNightmare Vulnerability
Jul 9, 2021 | Brad Sams
Understanding Windows Server 2016’s Disaster Recovery Features
Aug 29, 2018 | Michael Otey
What Are Shared Virtual Hard Disk Sets on Windows Server 2016 Hyper-V?
May 26, 2017 | Aidan Finn
What Is the Storage Resiliency of Windows Server 2016?
May 25, 2017 | Aidan Finn
SCARY: “Atom Bomb” Windows Security Hole said to be Unfixable
Oct 31, 2016 | Richi Jennings
Most popular on petri