Datrium Microsoft PowerShell Storage Spaces Windows Server

Building a highly available iSCSI Target utilizing S2D

Over the last couple years I’ve had customers ask me how to build a HA iSCSI target to support Microsoft failover clustering service for SQL or classic HA file shares. As Datrium doesn’t have a way to do this natively we needed a way to do it utilizing a virtual machine and have somewhat of a standardized platform with support behind it.

What I came up with is utilizing a S2D 2 way mirror to provide a HA iSCSI target and after deploying it for a few customers who are successfully running this I thought I would share my work.

Some Considerations if using DVX as the storage:

  • If you are building this on Datrium you need to consider the Cache implications. The disks on the individual server will dedup against each other, however as it is best practice to separate these two servers across hosts you will need to plan for the cache utilization across two servers.
  • When creating Datrium protection groups, be aware that Datrium is not aware of the iSCSI mounts in the guests and therefore you will need to include the S2D servers in your protection group to maintain consistency in a restore event.
  • S2D volumes on ReFS can not be mounted in Datrium GFR.
  • If you are building this for a SQL HA cluster I would recommend maintaining a secondary backup for SQL to be able to do DB restore. This could be using a native SQL backup job to a local .VMDK being backed up by Datrium.

Ok, now with that out of the way lets actually build out the S2D cluster and make this work. First a quick visual overview of what we are going to be building.

iscsi drawing

Firstly build your two VMs. I used Server 2019, but 2016 should work very similarly. When building the VMware VM, make sure to use a VMware PVSCSI controller for your disk controller, this becomes important later, and in fact is Microsoft best practice. Now that you have your SCSI controller correct, add 2 thin provisioned VMDK’s of the same size to each VM.

Once we have our VM’s built, let’s take a look at the Powershell commands I used to get this working.

# Install Cluster, and iSCSI roles
Install-WindowsFeature -Name File-Services, Failover-Clustering, FS-iSCSITarget-Server -IncludeManagementTools -ComputerName HC-Node1
Install-WindowsFeature -Name File-Services, Failover-Clustering, FS-iSCSITarget-Server -IncludeManagementTools -ComputerName HC-Node2

# Configure Cluster
New-Cluster -Name iSCSI -Node ctj-iscsi01.ctj.lan, ctj-iscsi02.ctj.lan -NoStorage -StaticAddress 192.168.1.11

# Ensure "CanPool" eq $true, and that the MediaType is set to SSD. You should see a total of 5 disks. 4 identical size and one that is your OS disk.
Get-PhysicalDisk

The result from Get-PhysicalDisk Should look something like this.

PS C:\Windows\system32> Get-PhysicalDisk

DeviceId FriendlyName        SerialNumber                     MediaType CanPool OperationalStatus HealthStatus Usage         Size
-------- ------------        ------------                     --------- ------- ----------------- ------------ -----         ----
0        VMware Virtual disk 6000c29dd5c17ee7121b33f2b79e51c4 SSD       False   OK                Healthy      Auto-Select  40 GB
1001     VMware Virtual disk 6000c29c21197787fec5063227357207 SSD       False   OK                Healthy      Auto-Select 100 GB
2002     VMware Virtual disk 6000c2926084056348d0935118e68b01 SSD       False   OK                Healthy      Auto-Select 100 GB
1002     VMware Virtual disk 6000c29a50a17ecb40b99b990aa939b6 SSD       False   OK                Healthy      Auto-Select 100 GB
2001     VMware Virtual disk 6000c298023239642ac90eae43e5464f SSD       False   OK                Healthy      Auto-Select 100 GB

If it does not show all 4 disks you have an issue with your cluster config. If you don’t see the serial numbers it means you’re not using a PVSCSI controller. If your disks are CanPool “false” make sure that the disk is clean, unconfigured and unclaimed.

# Set Unknowns to SSD
Get-PhysicalDisk | Where MediaType -eq "UnSpecified" | Set-PhysicalDisk -MediaType SSD

# Build the storage pool.
New-StoragePool -StorageSubSystemFriendlyName *Cluster* -FriendlyName S2D -ProvisioningTypeDefault Fixed -PhysicalDisk (Get-PhysicalDisk | ? CanPool -eq $true)

# Configure S2D
Enable-ClusterS2D -SkipEligibilityChecks -Autoconfig:0 -confirm:$false -PoolFriendlyName S2D -CacheState Disabled -verbose

That’s it! Now let’s make sure it works.

Open the cluster manager on one of the servers, select the storage pool and click “add new virtual disk.”

If you select this pool in the wizard and get an information popup that the pool isn’t configured properly for S2D Run “Disable-ClusterS2D” then re-run the Enable-ClusterS2D command from above.

After completing the VirtualDisk configuration wizard, create a volume that is the entire size of the disk.

Finally you can Build your iSCSI target server and disks as you normally would in windows.

%d bloggers like this: