Starwind vSAN Free on CVM (2 Node HA)

Software-based VM-centric and flash-friendly VM storage + free version

Moderators: anton (staff), art (staff), Max (staff), Anatoly (staff)

Post Reply
root
Posts: 2
Joined: Fri May 02, 2025 3:56 pm

Fri May 02, 2025 4:32 pm

Hello,

I am trying to setup two node HA using Starwind vSAN free with CVM deployment but currently facing issue.
Here is my setup:
Two Physical Windows Servers with 2x1SSDs (RAID 1) and 4x8HDDs (RAID 10).

Both Servers are connected to each other using two ethernet cables.
1 - External switch iSCSI (172.16.10.1/24) Host01 is 10.1 and Host02 is 10.2
2 - External switch Sync (172.16.20.1/24) Host01 is 20.1 and Host02 is 20.2

The servers are also connected to a managed switch for Management IP on 172.31.0.1/24 network
Host01 is 172.31.0.110
Host02 is 172.31.0.126

Note : I can ping all the provided IPs from both hosts.

I have imported CVM provided by Starwind to both the hosts and completed the initial setup. I added the RAID10 storage from both hosts as a HardDrive to both VMs. I than created Storage Pools and Volumes, but now I want to create a LUN which I cannot do it from webGUI because I am using free version.

I installed Starwind Management Console on both Hosts and I am trying to run the following Powershell Script, however I keep getting an error.

```
param($addr="172.31.0.110", $port=3261, $user="root", $password="starwind",
$addr2="172.31.0.126", $port2=$port, $user2=$user, $password2=$password,
#common
$initMethod="NotSynchronize",
$size=13631488,
$sectorSize=4096,
$failover=1,
$bmpType=1,
$bmpStrategy=0,
#primary node
$imagePath="/mnt/sdb1/vmStorage",
$imageName="device1",
$createImage=$true,
$storageName="",
$targetAlias="target1",
$poolName="",
$syncSessionCount=1,
$aluaOptimized=$true,
$cacheMode="none",
$cacheSize=0,
$syncInterface="#p2=172.16.20.2:3260",
$hbInterface="#p2=172.16.10.2:3260",
$createTarget=$true,
$bmpFolderPath="",
#secondary node
$imagePath2="/mnt/sdb1/vmStorage",
$imageName2="device1",
$createImage2=$true,
$storageName2="",
$targetAlias2="target1",
$poolName2="",
$syncSessionCount2=1,
$aluaOptimized2=$false,
$cacheMode2=$cacheMode,
$cacheSize2=$cacheSize,
$syncInterface2="#p2=172.16.20.1:3260",
$hbInterface2="#p2=172.16.10.1:3260",
$createTarget2=$true,
$bmpFolderPath2=""
)

Import-Module StarWindX

try
{
Enable-SWXLog -level SW_LOG_LEVEL_DEBUG


$server = New-SWServer -host $addr -port $port -user $user -password $password

$server.Connect()

$firstNode = new-Object Node

$firstNode.HostName = $addr
$firstNode.HostPort = $port
$firstNode.Login = $user
$firstNode.Password = $password
$firstNode.ImagePath = $imagePath
$firstNode.ImageName = $imageName
$firstNode.Size = $size
$firstNode.CreateImage = $createImage
$firstNode.StorageName = $storageName
$firstNode.TargetAlias = $targetAlias
$firstNode.SyncInterface = $syncInterface
$firstNode.HBInterface = $hbInterface
$firstNode.PoolName = $poolName
$firstNode.SyncSessionCount = $syncSessionCount
$firstNode.ALUAOptimized = $aluaOptimized
$firstNode.CacheMode = $cacheMode
$firstNode.CacheSize = $cacheSize
$firstNode.FailoverStrategy = $failover
$firstNode.CreateTarget = $createTarget
$firstNode.BitmapStoreType = $bmpType
$firstNode.BitmapStrategy = $bmpStrategy
$firstNode.BitmapFolderPath = $bmpFolderPath

#
# device sector size. Possible values: 512 or 4096(May be incompatible with some clients!) bytes.
#
$firstNode.SectorSize = $sectorSize

$secondNode = new-Object Node

$secondNode.HostName = $addr2
$secondNode.HostPort = $port2
$secondNode.Login = $user2
$secondNode.Password = $password2
$secondNode.ImagePath = $imagePath2
$secondNode.ImageName = $imageName2
$secondNode.CreateImage = $createImage2
$secondNode.StorageName = $storageName2
$secondNode.TargetAlias = $targetAlias2
$secondNode.SyncInterface = $syncInterface2
$secondNode.HBInterface = $hbInterface2
$secondNode.SyncSessionCount = $syncSessionCount2
$secondNode.ALUAOptimized = $aluaOptimized2
$secondNode.CacheMode = $cacheMode2
$secondNode.CacheSize = $cacheSize2
$secondNode.FailoverStrategy = $failover
$secondNode.CreateTarget = $createTarget2
$secondNode.BitmapFolderPath = $bmpFolderPath2

$device = Add-HADevice -server $server -firstNode $firstNode -secondNode $secondNode -initMethod $initMethod

while ($device.SyncStatus -ne [SwHaSyncStatus]::SW_HA_SYNC_STATUS_SYNC)
{
$syncPercent = $device.GetPropertyValue("ha_synch_percent")
Write-Host "Synchronizing: $($syncPercent)%" -foreground yellow

Start-Sleep -m 2000

$device.Refresh()
}
}
catch
{
Write-Host $_ -foreground red
}
finally
{
$server.Disconnect()
}
```

Output:
```
Request to HOST01 ( 172.31.0.110 ) : 3261
-
control ImageFile -CreateImage:"/mnt/sdb1/vmStorage\device1.img" -Size:"13631488" -Flat:"True" -DeferredInit:"True" -Password:"starwind"
-
200 Failed: operation cannot be completed..
```

Can you please help me how can I fix this? Whatever I am doing is correct setup or not?
I ultimately want to run a Failover Cluster with 2 Node HA, so if Host01 goes down VMs should still run on Host02 because the data is mirrors between the hosts.

Appreciate your help.
Thank You
Last edited by root on Fri May 02, 2025 5:01 pm, edited 2 times in total.
yaroslav (staff)
Staff
Posts: 3424
Joined: Mon Nov 18, 2019 11:11 am

Fri May 02, 2025 4:50 pm

Hi,
Welcome to StarWind Forum.
1. Use the Windows-based VSAN (https://www.starwindsoftware.com/tmplin ... ind-v8.exe), unless you need the software RAID feature or you are after NVMe-oF.
2. Check this out viewtopic.php?t=6852&p=37208&hilit=HINT8.

From what I see in your script:
1. Wrong failover strategy
2. poolName is missing

Good luck with your project.
root
Posts: 2
Joined: Fri May 02, 2025 3:56 pm

Fri May 02, 2025 5:07 pm

I tried running Windows Application VSAN management console before going to CVM route.
I added both the hosts in the Starwind management console.

I still have to run powershell script to create storage for failover, correct?
Here is the script I was running

```
param($addr="172.31.0.110", $port=3261, $user="root", $password="starwind",
$addr2="127.0.0.1", $port2=$port, $user2=$user, $password2=$password,
#common
$initMethod="syncFromFirst",
$size=500000,
$sectorSize=4096,
$failover=1,
$bmpType=1,
$bmpStrategy=0,
#primary node
$imagePath="V:\VirtualMachines",
$imageName="masterImg",
$createImage=$true,
$storageName="",
$targetAlias="targetha1",
$poolName="",
$syncSessionCount=1,
$aluaOptimized=$true,
$cacheMode="none",
$cacheSize=0,
$syncInterface="#p2={0}:3260" -f $addr2,
$hbInterface="",
$createTarget=$true,
$bmpFolderPath="",
#secondary node
$imagePath2="V:\VirtualMachines",
$imageName2="partnerImg",
$createImage2=$true,
$storageName2="",
$targetAlias2="partnerha2",
$poolName2="",
$syncSessionCount2=1,
$aluaOptimized2=$true,
$cacheMode2=$cacheMode,
$cacheSize2=$cacheSize,
$syncInterface2="#p1={0}:3260" -f $addr,
$hbInterface2="",
$createTarget2=$true,
$bmpFolderPath2=""
)

Import-Module StarWindX

try
{
Enable-SWXLog

$server = New-SWServer -host $addr -port $port -user $user -password $password

$server.Connect()

$firstNode = new-Object Node

$firstNode.HostName = $addr
$firstNode.HostPort = $port
$firstNode.Login = $user
$firstNode.Password = $password
$firstNode.ImagePath = $imagePath
$firstNode.ImageName = $imageName
$firstNode.Size = $size
$firstNode.CreateImage = $createImage
$firstNode.StorageName = $storageName
$firstNode.TargetAlias = $targetAlias
$firstNode.SyncInterface = $syncInterface
$firstNode.HBInterface = $hbInterface
$firstNode.PoolName = $poolName
$firstNode.SyncSessionCount = $syncSessionCount
$firstNode.ALUAOptimized = $aluaOptimized
$firstNode.CacheMode = $cacheMode
$firstNode.CacheSize = $cacheSize
$firstNode.FailoverStrategy = $failover
$firstNode.CreateTarget = $createTarget
# $firstNode.BitmapStoreType = $bmpType
# $firstNode.BitmapStrategy = $bmpStrategy
# $firstNode.BitmapFolderPath = $bmpFolderPath

#
# device sector size. Possible values: 512 or 4096(May be incompatible with some clients!) bytes.
#
$firstNode.SectorSize = $sectorSize

$secondNode = new-Object Node

$secondNode.HostName = $addr2
$secondNode.HostPort = $port2
$secondNode.Login = $user2
$secondNode.Password = $password2
$secondNode.ImagePath = $imagePath2
$secondNode.ImageName = $imageName2
$secondNode.CreateImage = $createImage2
$secondNode.StorageName = $storageName2
$secondNode.TargetAlias = $targetAlias2
$secondNode.SyncInterface = $syncInterface2
$secondNode.HBInterface = $hbInterface2
$secondNode.SyncSessionCount = $syncSessionCount2
$secondNode.ALUAOptimized = $aluaOptimized2
$secondNode.CacheMode = $cacheMode2
$secondNode.CacheSize = $cacheSize2
$secondNode.FailoverStrategy = $failover
$secondNode.CreateTarget = $createTarget2
# $secondNode.BitmapFolderPath = $bmpFolderPath2

$device = Add-HADevice -server $server -firstNode $firstNode -secondNode $secondNode -initMethod $initMethod

while ($device.SyncStatus -ne [SwHaSyncStatus]::SW_HA_SYNC_STATUS_SYNC)
{
$syncPercent = $device.GetPropertyValue("ha_synch_percent")
Write-Host "Synchronizing: $($syncPercent)%" -foreground yellow

Start-Sleep -m 2000

$device.Refresh()
}
}
catch
{
Write-Host $_ -foreground red
}
finally
{
$server.Disconnect()
}
```

However, I was getting the following error in Output.
```
Request to HOST01 ( 172.31.0.110 ) : 3261
-
control ImageFile -CreateHeader:"Headers\masterImg\masterImg.swdsk" -pathDirHeaderBackup:"V:\VirtualMachines" -file:"V:\VirtualMachines\masterImg.img" -Size:"500000" -CacheMode:"none" -CacheSizeMB:"0" -Blo
ckSize:"0" -psectorSize:"4096" -sectorSize:"4096"
-
200 Failed: file already exists.
```

After running the script when I RDP to Host01, I can see masterImg is created in that folder path with size 500GB. Please advise how can I move forward from here?

Thanks.
yaroslav (staff)
Staff
Posts: 3424
Joined: Mon Nov 18, 2019 11:11 am

Fri May 02, 2025 5:20 pm

Please use the script from my post above; I think it will be faster just re-ip my script and change the file location.
Post Reply