Adding 3rd Node to VSAN (Free) Using Powershell

Software-based VM-centric and flash-friendly VM storage + free version
Post Reply
ProblemSolver823
Posts: 2
Joined: Wed May 27, 2026 9:12 pm

Wed May 27, 2026 11:11 pm

I have used Starwind VSAN Free for the past six years or more without any issues. I use Powershell scripts to create HA Devices, view the synchronization status, and extend the size of devices regularly, so I am quite familiar with managing StarWind using the Powershell interface. My Setup is as follows:

Using StarWind Virtual SAN v8.0.0 (Build 20086, [SwSAN], Win64)
Built Nov 14 2025 11:08:28 6495b8edd

Two-Node VSAN Server Cluster installed on Physical Machines - Running on Windows Server 2022 that provide a HA Windows Failover Cluster.

Use Powershell to Setup and Configure StarWind VSAN with multiple targets and HA devices on each server.

I now need to add a third Node physical machine to the Existing HA Partner Pair to create a three node Windows Failover Cluster.

Mangement IP's
Node-1: 192.168.50.11 (already in cluster)
Node-2: 192.168.50.12 (already in cluster)
Node-3: 192.168.50.10 (new node to be added)

Synchronization Channels: 2 channels per HA pair
Sync between node 1 and 2: 172.16.50.1 and 172.16.50.2 , 172.16.60.1 and 172.16.60.2 (already in place and working)
Sync between node 2 and 3: 172.16.51.2 and 172.16.51.3, 172.16.61.2 and 172.16.61.3
Sync between node 1 and 3: 172.16.52.1 and 172.16.52.3, 172.16.62.1 and 172.16.62.3

HeartBeat Channels:
HB between node 1 and 2: 172.16.70.1 and 172.16.70.2 (already in place and working)
HB between node 2 and 3: 172.16.71.2 and 172.16.71.3
HB between node 1 and 3: 172.16.72.1 and 172.16.72.3

I have been trying to use the Add-HAPartner Script from the Examples folder to add the third node using the following Script modified with correct IP addresses, target name, and image name for the third node to synchronize with one of the existing HA devices that happens to be my witness target device:

Code: Select all

 param($addr="192.168.50.11", $port=3261, $user="root", $password="starwind", $deviceName="HAImage1",
	$addr2="192.168.50.10", $port2=$port, $user2=$user, $password2=$password,
#secondary node
	$imagePath2="My computer\D\iSCSI_HDD\AEC_Witness1",
	$imageName2="ptnr-wit-3",
	[bool][ValidateSet($false, $true)]
	$createImage2=$true,
	$targetAlias2="aecwitness13",
	[bool][ValidateSet($false, $true)]
	$autoSynch2=$true,
	$poolName2="pool1",
	$syncSessionCount2=1,
	[bool][ValidateSet($false, $true)]
	$aluaOptimized2=$false,
	$syncInterface2="#p1=172.16.52.1:3260;#p2=172.16.51.2" -f $addr,
    	$hbInterface2="#p1=172.16.72.1:3260;#p2=172.16.71.2" -f $addr,
	$bmpType=1,
	$bmpStrategy=0,
	$bmpFolderPath="" ,
    	$selfSyncInterface="#p1=172.16.52.3:3260;#p2=172.16.51.3" -f $addr2,
    	$selfHbInterface="#p1=172.16.72.3:3260;#p2=172.16.71.3" -f $addr2
	)


Import-Module StarWindX

try
{
    Enable-SWXLog -level SW_LOG_LEVEL_DEBUG 
    
    $server = New-SWServer $addr $port $user $password
    $server.Connect()

	$device = Get-Device $server -name $deviceName
	if( !$device )
	{
		Write-Host "Device not found" -foreground red
		return
	}

    	$node = new-Object Node
    	$node.HostName = $addr2
    	$node.HostPort = $port2
    	$node.Login = $user2
    	$node.Password = $password2
    	$node.ImagePath = $imagePath2
   	$node.ImageName = $imageName2
    	$node.CreateImage = $createImage2
    	$node.TargetAlias = $targetAlias2
    	$node.SyncInterface = $syncInterface2
  	$node.HBInterface = $hbInterface2
	$node.AutoSynch = $autoSynch2
	$node.SyncSessionCount = $syncSessionCount2
	$node.ALUAOptimized = $aluaOptimized2
	$node.PoolName = $poolName2
    	$node.BitmapStoreType = $bmpType
    	$node.BitmapStrategy = $bmpStrategy
	$node.BitmapFolderPath = $bmpFolderPath

    Add-HAPartner $device $node $selfSyncInterface $selfHbInterface $selfBmpFolderPath
}
catch
{
	Write-Host $_ -foreground red 
}
finally
{
	$server.Disconnect()
}

  
The script returns the error:
One or more interfaces are not belong to primary node!

I have tried changing the $SyncInterface2 and $hbInterface2 only to remove the P2 ip addresses which leave only the ip addresses for the Primary Node as follows:
$syncInterface2="#p1=172.16.52.1:3260" -f $addr,
$hbInterface2="#p1=172.16.72.1:3260",
I leave the $selfSyncInterface and $selfHbInterface with both P1 and P2 values unchanged.
However when I run the script that way, I receive the following error:

Mandatory parameters are missed

There is no indication of what parameters are missing but something is not correct, however, a second partner target is created on both the first and second server nodes showing the second target as the third server node using the correct sync and heartbeat addresses to connect to the third server node, however, the target is not created on the third server node and the image device is not created on the third server node either. The Log file reports that the Target is not found on the third server node because it has not been created by the script. The log continues to fail to connect to the target specified until I use the Remove-HAPartner to remove the partners created incorrectly.

Can anyone describe specifically how to use the P1 and P2 interfaces in the script with the correct syntax so that the Add-HAPartner script runs correctly and adds a third node to the existing two-node HA Partnership and creates the target and HA device on the third node ready for synchronization? There is very little information on how to add the third node using the Powershell script. Is the image, device, and target on the third node supposed to be manually created before using the Add-HAPartner script to create a three-node cluster? Any information that anyone can provide to lead me in the right direction would be greatly appreciated.
yaroslav (staff)
Staff
Posts: 4373
Joined: Mon Nov 18, 2019 11:11 am

Thu May 28, 2026 7:17 am

Welcome to StarWind Forum.
The IPs you use need to be pointing to the opposite node. In other words, on node1, you need to input the IPs of the second node (p1) and the third node (p2). The Primary node needs to be pointing to p2 and p3, secondary - p1 and p3, third - p1 and p2. You can refer to CreateHA3_ps1 for more details. The script breakdown is here viewtopic.php?f=5&t=6852&p=37208&hilit=HINT8#p37208. You don't need -f $addr bit too.
Make sure to use syncfromfirst as $initmethod - that will sync the new device from the primary node.
Good luck with your project.
ProblemSolver823
Posts: 2
Joined: Wed May 27, 2026 9:12 pm

Thu May 28, 2026 5:42 pm

I have studied the CreateHA3_ps1 script and the ip addresses that are used in that scenario for each of the three nodes. It is much clearer if I were creating the three-node cluster from scratch using this script. However, in my case, a two-node cluster is already setup, so I am trying to add the third node to the existing two node cluster. It is my understanding that the Add-HAPartner script is for the purpose of adding a second node or third node to an existing HA Image. The script only has a single node creation block and unlike the CreateHA3 script there is no description of the Primary Node or Second Node which in my case already exist. You also mention that I should set $initmethod as "SyncFromFirst", however, there is no $initmethod parameter in the Add-HAPartner method. Unlike the Add-HADevice method, that powershell method only uses a device object (the existing HA device on Node 1), a single node object (the parameters for the third Node being added), the $selfSyncInterface, $selfHbInterface, and $selfBmpFolderPath which I assume are used by the other partners how to reach the new partner node.

It seems to me that the IP addresses in the $syncInterface and $hbinterface object should contain the IP addresses that would be used for the newly created partners object on Node 3 that provide Node 3 the IP addresses to use to connect to the other partners targets, Node 1 (P1) and Node 2 (P2) as follows:

$syncInterface=$("#p1=172.16.52.1:3260;#p2=172.16.51.2:3260"),
$hbInterface=$("#p1=172.16.72.1:3260;#p2=172.16.71.2:3260"),

I assume that the $selfSyncInterface and $selfHBInterface are the IP addresses on Node 3 that are used to tell Node 1 and Node 2 how they should connect to the new third node partner target with P1 representing how Node 1 will connect to Node 3 target and P2 representing how Node 2 will connect to Node 3 target as follows:

$selfSyncInterface=$("#p1=172.16.52.3:3260;#p2=172.16.51.3:3260"),
$selfHbInterface=$("#p1=172.16.72.3:3260;#p2=172.16.71.3:3260")

However, using these values, the error is : One or more interfaces are not belong to primary node!
This would seem to indicate that the IP addresses for $syncInterface and $hbinterface should only contain IP addresses for the Primary Node (P1) but in that case, there is no where to specify how Node 3 will connect to the Node 2 partner.

If the $syncInterface and $hbInterface parameters are limited to only P1 as follows:
$syncInterface=$("#p1=172.16.52.1:3260"),
$hbInterface=$("#p1=172.16.72.1:3260"),
Then, the error changes to : Mandatory parameters are missed

Even with the error, the script does create the partner targets using the sync and heartbeat channels specified to connect to Node 3 on both Node 1 and Node 2 respectively but the new target is not created on Node 3. Therefore, I assume the missing parameters error to be a result of not having the necessary IP address available to connect to Node 2 when trying to create the new target object on Node 3 and thus it fails. So, how do I specify the IP address necessary for Node 3 to connect to Node 2 without getting the previous error about one or more interfaces do not belong to the primary node so that the script can complete without error?
yaroslav (staff)
Staff
Posts: 4373
Joined: Mon Nov 18, 2019 11:11 am

Fri May 29, 2026 8:12 am

You also need a primary node interface (i.e., so that the primary node speaks to other nodes). I've logged the internal request for you, yet I am afraid it might take a while.
It looks like we need to resort to the trick. Create a HA device (test one) with CreateHA3.ps1. Note the structure of the _HA.SWDSK of that file.
Next, you can try adding the node with the default AddHAPartner.ps1 to add the replication partner for one node. Then
1. stop the starwindservice on one node (the usual restart precautions apply)
2. edit the _HA.SWDSK file.
3. start the service.
4. wait for fast sync to complete.
5. repeat 1-4 for the 2nd node; please note that the IP addresses in _HA.swdsk will be different.
6. repeat 1-4 for the newly added node.

P.S. I am bad with scripting, but "I tried" :D Give this one a shot.

Code: Select all

param(
    # --- Primary Node (Node 1 - Existing Master) ---
    $addr="192.168.0.1", $port=3261, $user="root", $password="starwind", $deviceName="HAImage1",
    
    # --- Secondary Node (Node 2 - Existing Partner) ---
    $addr2="192.168.0.2",
    
    # --- Third Node (Node 3 - New Partner to Add) ---
    $addr3="192.168.0.3", $port3=3261, $user3="root", $password3="starwind",

    # --- Node 3 Target Settings ---
    $imagePath3="My computer\C\starwind",
    $imageName3="partnerImg3",
    $createImage3=$true,
    $targetAlias3="partnerha3",
    $autoSynch3=$true,
    $poolName3="pool1",
    $syncSessionCount3=1,
    $aluaOptimized3=$false,
    
    # --- Sync Interfaces for Node 3 ---
    # Node 3 must connect to BOTH Node 1 (#p1) and Node 2 (#p2)
    $syncInterface3=$("#p1={0}:3260;#p2={1}:3260" ),
    $hbInterface3="",
    
    # --- Bitmap Settings ---
    $bmpType=1,
    $bmpStrategy=0,
    $bmpFolderPath3="",

    # --- Updated Interfaces for Node 1 (Self) ---
    # Node 1 must now maintain its connection to Node 2 (#p1) AND connect to Node 3 (#p2)
    $selfSyncInterface=$("#p1={0}:3260;#p2={1}:3260"),
    $selfHbInterface="",
    $selfBmpFolderPath=""
)
	
Import-Module StarWindX

try
{
    Enable-SWXLog
    
    # Connect to the existing primary node
    $server = New-SWServer $addr $port $user $password
    $server.Connect()

    $device = Get-Device $server -name $deviceName
    if( !$device )
    {
        Write-Host "Device not found: $($deviceName)" -foreground red
        return
    }

    # Define the new partner (Node 3)
    $node = new-Object Node
    $node.HostName = $addr3
    $node.HostPort = $port3
    $node.Login = $user3
    $node.Password = $password3
    $node.ImagePath = $imagePath3
    $node.ImageName = $imageName3
    $node.CreateImage = $createImage3
    $node.TargetAlias = $targetAlias3
    $node.SyncInterface = $syncInterface3
    $node.HBInterface = $hbInterface3
    $node.AutoSynch = $autoSynch3
    $node.SyncSessionCount = $syncSessionCount3
    $node.ALUAOptimized = $aluaOptimized3
    $node.PoolName = $poolName3
    $node.BitmapStoreType = $bmpType
    $node.BitmapStrategy = $bmpStrategy
    $node.BitmapFolderPath = $bmpFolderPath3

    Write-Host "Adding third HA partner ($addr3) to device $($deviceName) on ($addr)..." -foreground yellow
    
    # Execute the addition
    Add-HAPartner $device $node $selfSyncInterface $selfHbInterface $selfBmpFolderPath
    
    Write-Host "HA Partner successfully added. Synchronization will begin according to device policies." -foreground green
}
catch
{
    Write-Host $_ -foreground red 
}
finally
{
    $server.Disconnect()
}
Post Reply