Cant create ISCSI target

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

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

Post Reply
dgilkey
Posts: 1
Joined: Mon Sep 16, 2024 1:19 am

Mon Sep 16, 2024 1:23 am

Here is my sample script:

Code: Select all

param($addr="10.0.0.250", $port=3261, $user="root", $password="starwind",
	$fileName="vmware",
	$filePath="VSA Storage\mnt\md0\datastore",
	$size=13000GB,
	$targetAlias="vmwaretarget",
	$sectorSize=4096,
	$numaNode=0,
	$cacheMode="writeback",
	$cacheSize=16GB)

Import-Module StarWindX

try
{
	Enable-SWXLog -level SW_LOG_LEVEL_DEBUG

	if($sectorSize -eq 4096 -and $size -lt 2)
	{
		throw "Minimal device size 2MB"
	}

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

	$server.Connect()

	#create image file
	New-ImageFile -server $server -path $filePath -fileName $fileName -size $size
    
	#create device
	$device = Add-ImageDevice -server $server -path $filePath -fileName $fileName -sectorSize $sectorSize -NumaNode $numaNode -CacheMode $cacheMode -CacheSize $cacheSize

	$device
    
	#create target
	$target = New-Target -server $server -alias $targetAlias -devices $device.Name

	$target
}
catch
{
	Write-Host $_ -foreground red
}
finally
{
	$server.Disconnect()
}
I get this error:

-
control ImageFile -CreateImage:"VSA Storage\mnt\md0\datastore\vmware.img" -Size:"13958643712000" -Flat:"True" -DeferredInit:"True"
-
200 Failed: There is not enough space on the disk..


But under free capacity:

Mounted

md0

14.16 TB

14.05 TB

Standard

-

/mnt/md0/datastore

Any ideas?
yaroslav (staff)
Staff
Posts: 3424
Joined: Mon Nov 18, 2019 11:11 am

Mon Sep 16, 2024 12:01 pm

Hi,

Welcome to StarWind Forum and thanks for your post.
There are several things that are not OK with this script:
1. Do not use WB caching for a standalone image.
2. you are referring to the wrong path name is wrong. See how to specify it correctly viewtopic.php?f=5&t=6852&p=37208&hilit=HINT8#p37208.
3. Setting 4k for the sectorSize will this target not usable in Linux. Set it to 512 for interoperability.

If you want to create the HA device later, please use viewtopic.php?f=5&t=6852&p=37208&hilit=HINT8#p37208.
riazd
Posts: 2
Joined: Sat Apr 19, 2025 11:18 pm

Tue Apr 22, 2025 12:35 am

Hi,

I can create the ISCSI lun but it just says "synchronizing" at 0% forever. I tried it a couple of times thus device2 and target 3 but same issue. VSAN free license. Any ideas where I am going wrong?

param($addr="10.75.0.38", $port=3261, $user="root", $password="starwind",
$addr2="10.75.0.39", $port2=$port, $user2=$user, $password2=$password,
#common
$initMethod="NotSynchronize",
$size=850,
$sectorSize=512,
$failover=0,
$bmpType=1,
$bmpStrategy=0,
#primary node
$imagePath="/mnt/sdb1/vm1",
$imageName="device2",
$createImage=$true,
$storageName="",
$targetAlias="target3",
$poolName="pool1",
$syncSessionCount=1,
$aluaOptimized=$true,
$cacheMode="none",
$cacheSize=0,
$syncInterface="#p2=172.16.20.11:3260",
$hbInterface="#p2=172.16.10.11:3260",
$createTarget=$true,
$bmpFolderPath="",
#secondary node
$imagePath2="/mnt/sdb1/vm1",
$imageName2="device2",
$createImage2=$true,
$storageName2="",
$targetAlias2="target3",
$poolName2="pool1",
$syncSessionCount2=1,
$aluaOptimized2=$false,
$cacheMode2=$cacheMode,
$cacheSize2=$cacheSize,
$syncInterface2="#p1=172.16.20.21:3260",
$hbInterface2="#p1=172.16.10.21: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()
}
yaroslav (staff)
Staff
Posts: 3424
Joined: Mon Nov 18, 2019 11:11 am

Tue Apr 22, 2025 7:20 am

Check the MTU and make sure it is set to 1500 on the entire stack. Could you please tell me what hypervisor you have?
riazd
Posts: 2
Joined: Sat Apr 19, 2025 11:18 pm

Tue Apr 22, 2025 9:40 pm

Hi,

Using VMware 8.0 update 2. Updated and confirmed that all vmkernels are set to MTU 1500. Rebooted appliances and tried again but same issue.
dScreenshot 2025-04-22 143601.jpg
dScreenshot 2025-04-22 143601.jpg (179.95 KiB) Viewed 6071 times
yaroslav (staff)
Staff
Posts: 3424
Joined: Mon Nov 18, 2019 11:11 am

Wed Apr 23, 2025 8:03 am

Try synchronizing them manually. Force synchronization, try using manual synchronization. Use SyncHaDevice.ps1, comment $device.Synchronize([SwHaSyncType]::SW_HA_SYNC_FULL, "") and uncomment #$device.MarkAsSynchronized()
User avatar
Mathew78
Posts: 2
Joined: Wed Apr 23, 2025 12:06 pm
Location: California, US
Contact:

Fri Apr 25, 2025 11:58 am

I understand the complexities and concerns surrounding data integrity, especially when dealing with caching mechanisms in virtualized environments.

What you may try n do is..

1. Write-Through Policy
For single-node setups, it's advisable to use StarWind's Write-Through caching policy. This ensures that data is written directly to disk, minimizing the risk of data loss in the event of a power failure.

2. High Availability (HA)
In multi-node configurations, enabling Write-Back caching can enhance performance. However, it's imperative to ensure that HA is correctly configured, with proper synchronization and failover mechanisms in place.

3. Regular Backups
Regardless of the caching strategy, maintaining regular backups is essential. This provides an additional layer of protection against unforeseen failures.​

4. Monitoring and Alerts
Implement monitoring tools to keep an eye on the health of your storage infrastructure. Setting up alerts can help in proactively addressing potential issues before they escalate.

It's essential to weigh the performance benefits against potential risks, ensuring that data integrity remains a top priority.​

For more detailed guidance, consider reviewing StarWind's official documentation or consulting with their support team.​

Note: Always test any configuration changes in a controlled environment before deploying them to production.
yaroslav (staff)
Staff
Posts: 3424
Joined: Mon Nov 18, 2019 11:11 am

Fri Apr 25, 2025 12:17 pm

StarWind's Write-Through caching policy
Write through boosts reads. Reading is mostly OK, so no need to enable Write-Through in StarWind VSAN.
StarWind VSAN caching in general does not make much sense for SSDs
Write-back caching makes HAs more touchy.
3. Regular Backups
Check this out https://www.starwindsoftware.com/best-p ... practices/.
4. Monitoring and Alerts
...
It's essential to weigh the performance benefits against potential risks, ensuring that data integrity remains a top priority.​
...
Note: Always test any configuration changes in a controlled environment before deploying them to production.
VERY good points.
Post Reply