CreateImage Plugin is not supported

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

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

Post Reply
erion2022
Posts: 2
Joined: Sun Apr 16, 2023 8:02 pm

Sun Apr 16, 2023 8:07 pm

Hi all.
I've been strungling with this powershell script to create imagefile without success.
I've created VLT device without problem.

I don't know where to check anymore:

Here is my script:

param($addr="127.0.0.1", $port=3261, $user="root", $password="starwind",
$fileName="img1.img",
$starwindfiletype="img",
$filePath="My Computer\C\starwind",
$size=12,
$targetAlias="targetimg1",
$sectorSize=512,
$numaNode=0,
$cacheMode="wb",
$cacheSize=128)

Import-Module StarWindX

try
{
Enable-SWXLog

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()

Write-Host "Creating ImageFile" (just to understand where the script fail)

#create image file
New-ImageFile -server $server -path "My Computer\C\starwind" -fileName "img1.img" -size 2048


Write-Host "Creating ImageDevice" (just to understand where the script fail)

#create device
$device = Add-ImageDevice -server $server -path "My Computer\C\starwind" -fileName "img1.img" -sectorSize $sectorSize -NumaNode $numaNode -CacheMode $cacheMode -CacheSize $cacheSize

$device

Write-Host "Creating Target" (just to understand where the script fail)

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

$target
}
catch
{
Write-Host $_ -foreground red
}
finally
{
$server.Disconnect()
}
Attachments
Plugin is not supported.png
Plugin is not supported.png (4.37 KiB) Viewed 883 times
yaroslav (staff)
Staff
Posts: 2361
Joined: Mon Nov 18, 2019 11:11 am

Sun Apr 16, 2023 9:09 pm

Hi,
Are you running StarWind Service on the host where you running the script? Are you planning a standalone device?
Try $fileName="img1", also make sure the folder exists.
Please also note that write-back caching can result in data loss for non-replicated devices in case of service termination or power outage. In other words, please make sure to create a device with no cache.
erion2022
Posts: 2
Joined: Sun Apr 16, 2023 8:02 pm

Sun Apr 16, 2023 10:02 pm

Well, this is just a lab for testing purposes.
What I realize is that I was using a free VLT license. I have installed a free vsan license and I was able to create image and vlt device.

Thank you.
yaroslav (staff)
Staff
Posts: 2361
Joined: Mon Nov 18, 2019 11:11 am

Mon Apr 17, 2023 8:30 am

StarWind VTL is a whole different device type as compared to the *img.
Were you able to create the *.img with the script suggestion mentioned above?
Post Reply