Use Windows Server as iSCSI target with ESXi
The task: to move a virtual machine from one ESXi to another. The ESXis are on two completely separate networks. VM size is 5.5 TB, with one file being 5TB.
The problem: VM cannot be started due to maxed out resources. There’s no NAS or any other means of storage where the files could be transferred to. From previous experience, I knew that transfer over SSH or USB would be well too slow, as the task was time critical. There wasn’t also a big enough single hard disk which could be used to copy the files onto it.
My proposed solution: Use any spare desktop/server and load it with hard drives, so that all of them can create spanned virtual disk big enough to accommodate files from ESXi, install at least server 2012r2 on it and configure as an ISCSI target.
As you can see above, it was quite an unusual task with quite unusual conditions.
- Windows box:
- Spare computer
- 1HDD for OS
- Number of HDDs, which summarised capacity would be enough to accommodate files from ESXi. HDDs might be a different size
- One network adapter
- Source and destination ESXi:
- at least one spare network port which can be configured as uplink
- Possibility to enable iSCSI (I was working on ESXi 6.5)
Let’s start preparation!
Prepare Windows server
I take it you’ve prepared a fresh installation of Windows server, if not go ahead and do it. I’ve used 2012 R2 for the purpose of the task. Don’t forget to activate it.
Another important step is to configure network card you’re going to use with static IP – as we will tell ESXi to connect to the server over that IP. All you need is
Unless you’re willing to connect over the network then obviously gateway would be needed. However, it is strongly recommended to use iSCSI on
Create spanned volume
Once you’ve got your server ready for a spin – the first step is to create a spanned volume – we will simply use all spare hard drives and create one massive disk out of them. I’ve used 1TB, 3TB and 4TB disks, which
You’d like to press CTRL + X and bring disk manager. Then right-click on each of the disks and initialize it, then bring them online. In my example, the disks are numbered 1,2 and 3.
Next step is the actual creation of the Spanned Volume, you click on any of the spare disks, and choose “New Spanned Volume”, click next and on “Select Disks” page Add all disks, so that total volume size shows summed storage space from all of them. You assign any letter drive you want, give any name (I called mine BIG) and make sure to tick Perform
That’s it, once you click finish you will see the colour of disks changing to purple-ish, and all three disks will have the same partition name with
Install iSCSI Target Server role
Now it’s time to add iSCSI role so that we can create the iSCSI disk and attach it to ESXi. iSCSI is a technology which allows you to
Bring up Add roles and features wizard, and on “Server roles” tab check: File and Storage Service > File and iSCSI Services > iSCSI Target Server, accept the default and go ahead with the installation.
You can achieve the same result using Windows Powershell by using the command:
Install-WindowsFeature -Name FS-iSCSITarget-Server
Create iSCSI disk and target
Final step of our configuration is the actual creation of iSCSI virtual disk.
Head on to the server manager, go to the Files and storage pane > choose iSCSI tab. Click on TASKS and choose “New iSCSI Virtual Disk”
On the new windows that shows up, choose the location on your newly created spanned disk (F: in my case), provide any meaningful name. On the disk size, choose max available space (7.81TB in my case) and choose the
There’s no need for authentication here, so just move on next and finish the wizard, which will end up in creating the iSCSI disk with
#Create iSCSI disk New-IscsiVirtualDisk -Path F:\iSCSIVirtualDisks\iSCSI1.vhdx -Size 7.81TB #Create iSCSI target New-IscsiServerTarget -TargetName target1 -InitiatorIds IPAddress:10.4.1.5 #Assign iSCSI disk to the target Add-IscsiVirtualDiskTargetMapping -TargetName target1 -Path F:\iSCSIVirtualDisks\iSCSI1.vhdx
At this point
Create VMKernel NIC
To start with I wanted to thanks Andy who helped me with VMkernel NIC configuration – it would take me much longer to figure out this myself! Drop me the line if you’re reading
In order to connect
We need to configure Virtual switch, port group and finally VMKernal NIC
Click on Networking pane and choose Virtual Switches tab. Down there choose an option to add a new switch. In the new Window that pops out give it a
Next click on Port groups tab and choose ato add port group, give it meaningful name, choosing the switch you’ve just created.
The final step is to click on VMkernel NICs tab and add the new VMkernel NIC. Choose port group you’ve created in the previous step, then choose that IP should be static and give it IP address in the same subnet as your Windows machine.
I configured my Windows machine to be 10.4.1.5/24 and VMkernel NIC to be 10.4.1.4/24
Add iSCSI disk and configure it as datastore
We’re coming to the very end of the configuration – everything has been configured and the last step is to create a datastore on the iSCSI disk.
Click on storage pane and choose Adapters and click on Configure iSCSI, on the new windows choose to enable iSCSI, and type in the dynamic address field type in the IP of Windows machine, confirm.
After that head on to Datastores tab and choose Add Datastore to create new VMFS datastore, point it to the Windows datastore and
That’s it, you can use newly created datastore as it was the
You can obviously use this configuration in any different scenarios
Yet this non-typical topic allowed me to complete this very strange situation within
Have you found yourself? Do you know any other means of achieving
How’s my story ended?
After connecting Windows Server to vSphere with
Hit the start button, choose the VM was copied and boom – I had a working VM directly from the external disks. From that point on I was able to install
Problem solved! Yay!