As you know, Server 2012 natively supports creating iSCSI targets. It’s great addition and i want to demonstrate how to set up this feature in core environment using only Powershell
My test equipment:
iSCSI Initiator – Hyper-V VM on Server 2012
iSCSI Target – Intel Server System S1530SH with 2 SATA 500 Gb in RAID 1 and external RAID Controller with three different RAID 1.
It’s not very old server system but, comparing with newest server systems, it seems very slow during some tasks. Anyway, installation Server 2012 Datacenter Core takes about 6 minutes. Great? I think it’s pretty nice result.
Configuring iSCSI Server Target
1. Type powershell in the command line then Rename-Computer -NewName yourpcname -Restart . This cmdlet lets you change standard name of your server.
Also, i recommend to execute Update-Help cmdlet to get the latest help pages.
2. After successful restart we need to configure ip parameters. Type Get-adapter to show all network adapters in your system and their status. Remember NIC’s Index number. For example, NIC with 12 looks to iSCSI , NIC with 13 – internal
Changing ip properties at NIC with index 12
Type ipconfig /all to see result
3. Installing iSCSI Target feature. Type Get-WindowsFeature to see all available features in Server 8 and then Add-WindowsFeature FS-iSCSITarget-Server.
4. Enabling Remote Desktop Services to management . However, you can use remote powershell connection
5. Creating partitions and VHD on our disks
Get-Disk to see what disks are available in the system
I have some old information on these disks, so i should run Clear-Disk -RemoveData to prepare them for new partitions and volumes
We have to initialize all disks before creation new partition using New-Partition cmdlet
Formatting partition using Format-Volume cmdlet
Creating Vitrual Disks on each partitions which we want to share through iSCSI Target New-iSCSIVirtualDisk c:\test\disk1.vhd -Description “test” -Size 10Gb
6. Setting up new iSCSI Target Server, disks mapping
New-iSCSIServerTarget testTarget -IntiatorIDs “IQN:iqn. … “
test – your target name, intitiatorID – client’s id to access target.
How can i get InitiatorID?
You have to use iscsicli command
Create Target : New-iSCSIServerTarget NameOfTarget -InitiatorIDs “IQN:iqn….”
Mapping our VHDs to iSCSI Target
Add-iSCSIVirtualDiskTarget Test s:\test\disk2.vhd
Configuring iSCSI Initiator on the client machine
1. Starting iSCSI Intiator
2. Connecting to created iSCSI Portal
New-iSCSITargetPortal -TargetPortalAddress YourTargetIP
Get-iSCSItarget |FL > shows your added target portal
Connect-iSCSITarget -NodeAddress “your target IQN”
Get-Disk to see iSCSI disks. By default, they are in offline status
Taking disks to online operational status using Set-Disk
Finally, we’ll create new partitions and volumes. Notice , if your iSCSI disks are using for DPM Backups , it’s not necessary to create volumes. DPM can create them by itself.
New-Partition -DiskNumber _ -UseMaximumSize -DriveLetter _
UseMaximumSize lets to create partitions with the biggest size as possible.
Get-Partition -DiskNumber YourDisksNumbers | Format-Volume
Any questions or comments? Leave a reply!