The Latest Gartner® Magic Quadrant™Hyperconverged Infrastructure Software
Code: Select all
root@vSAN1:/mnt/md0/vSANStrg# ll
total 1048592
drwxr-xr-x 3 root root 112 Jul 26 11:29 ./
drwxr-xr-x 3 root root 4096 Jul 25 20:16 ../
-rw-r--r-- 1 root root 33 Jul 25 20:17 starwind-volume-config.json
drwxr-xr-x 2 root root 6 Jul 25 20:18 vsn/
-rw-r--r-- 1 root root 4096 Jul 26 11:29 vsn_HA.swdsk.bak
-rw-r--r-- 1 root root 1073741824 Jul 26 11:29 vsn.img
-rw-r--r-- 1 root root 4096 Jul 26 11:29 vsn.swdsk.bak
root@vSAN1:/mnt/md0/vSANStrg# ll vsn
total 0
drwxr-xr-x 2 root root 6 Jul 25 20:18 ./
drwxr-xr-x 3 root root 112 Jul 26 11:29 ../
root@vSAN1:/mnt/md0/vSANStrg#Code: Select all
param($addr="192.168.30.225", $port=3261, $user="root", $password="starwind",
$addr2="192.168.30.226", $port2=$port, $user2=$user, $password2=$password,
#common
$initMethod="NotSynchronize",
$size=1024,
$sectorSize=512,
$failover=0,
$bmpType=1,
$bmpStrategy=0,
#primary node
$imagePath="/mnt/md0/vSANStrg",
$imageName="vsn",
$createImage=$true,
$storageName="",
$targetAlias="vsn",
$poolName="pool1",
$syncSessionCount=1,
$aluaOptimized=$true,
$cacheMode="none",
$cacheSize=0,
$syncInterface="#p2=192.168.35.226:3260,192.168.40.226:3260",
$hbInterface="#p2=192.168.45.226:3260,192.168.30.226:3260",
$createTarget=$true,
$bmpFolderPath="",
#secondary node
$imagePath2="/mnt/md0/vSANStrg",
$imageName2="vsn",
$createImage2=$true,
$storageName2="",
$targetAlias2="vsn",
$poolName2="pool1",
$syncSessionCount2=1,
$aluaOptimized2=$false,
$cacheMode2=$cacheMode,
$cacheSize2=$cacheSize,
$syncInterface2="#p1=192.168.35.225:3260,192.168.40.225:3260",
$hbInterface2="#p1=192.168.45.225:3260,192.168.30.225: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.AutoSynch = $autoSynch
$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.AutoSynch = $autoSynch2
$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()
}Thanks Yaroslav,yaroslav (staff) wrote: ↑Sun Jul 27, 2025 8:08 amThanks for your update. How does the WEB UI look like now?
Understood, and appreciate all the help, will do a different build to understand it better..yaroslav (staff) wrote: ↑Sun Jul 27, 2025 12:08 pmit seems to be created successfully: The LUN is in HA. The script you shared below creates 1GB device. (Size is in MB)
Since I only have 1 storage server at the moment, how can I configure the script to setup the LUN on the 1st server, do I just remove Secondary Node and its references from the script ?
Code: Select all
One or more errors occurred. (Create pool on appliance 'vSAN2' failed: One or more errors occurred. (Error 1: . Warning: Not all of the space available
to /dev/sda appears to be used, you can fix the GPT to use all of the space (an extra 2097152 blocks) or continue with the current setting?
Warning: Unable to open /dev/sr0 read-write (Read-only file system). /dev/sro has been opened read-only. Error: Invalid partition table - recursive partition on /dev/sr0.
FailCode: Select all
Request to 192.168.30.151 ( 192.168.30.151 ) : 3261
-
control ImageFile -CreateImage:"/mnt/md0/vol1\vlab.img" -Size:"598100" -Flat:"True" -DeferredInit:"True" -Password:"starwind"
-
200 Failed: There is not enough space on the disk..