How do I check VIA RAID status in Windows, not using GUI? There's no CLI tool in driver package.
-
you should have the possibility to activate/use and/or use snmp to check the staus of your RAID and disks. – Sorcha Jan 09 '17 at 10:15
2 Answers
VIA RAID was never intended to be used on server, but only on client machines. I strongly suspect it has no (documented) CLI, but only a simple GUI. Giving a look at the RAID driver package located here, and extractig the relevant documentation (in CHM format, converted in PDF here), there is no mention at all of a CLI of any sort.
Moreover, VIA consumer chipset division was disbanded many years ago, so you should really think to replace that machine.

- 47,711
- 7
- 111
- 180
-
Yeah, I've read the documentation beforehand. Unfortunately there's no spare money to replace that machine, even more so it works as expected. It's just that it will be more convenient to automate the RAID status check process. – real_sm Jan 09 '17 at 10:57
-
*Maybe* the RAID driver writes something to Windows System Log, which cab be parsed by automatic tools. Give a look at it. – shodanshok Jan 09 '17 at 11:14
OK, in the Windows driver package there's a DLL named drvInterface.dll, so it's possible to use it. Interesting, but all the functions and datatypes are described in a PDF only in a Linux driver package. :) Though, that description is not 100% correct, so better to check with header file (also only in Linux driver package).
Anyway, here's a script in AutoIt that uses drvInterface.dll to get array and disks statuses (returns "1" if everything is OK and "0" if there's any error). With more effort you can get disks models, serial numbers and other data present in VIA RAID Tool interface:
#NoTrayIcon
#include <Array.au3>
Local $pTest
Global $bStatus = True
$hDLL = DllOpen(@ScriptDir & "\drvInterface.dll")
If @error <> 0 Then
$bStatus = False
EndIf
_checkStatus()
;~ VINT vr_init (void);
$sTest = DllCall($hDLL, "int:cdecl", "?vr_init@@YAHXZ")
If @error <> 0 Then
$bStatus = False
EndIf
_checkStatus()
;~ VINT vr_get_controller_num (VINT *pnumber);
$sTest = DllCall($hDLL, "int:cdecl", "?vr_get_controller_num@@YAHPAH@Z", "int*", $pTest)
If @error <> 0 Then
$bStatus = False
EndIf
_checkStatus()
If IsArray($sTest) and UBound($sTest) >= 2 Then
$iControllerNumber = $sTest[1]
Else
$bStatus = False
EndIf
_checkStatus()
;~ VINT vr_get_array_num (VINT only_raid, VINT *pnumber);
$sTest = DllCall($hDLL, "int:cdecl", "?vr_get_array_num@@YAHHPAH@Z", "int", 0, "int*", $pTest)
If @error <> 0 Then
$bStatus = False
EndIf
_checkStatus()
If IsArray($sTest) and UBound($sTest) >= 3 Then
$iArrayNumber = $sTest[2]
Else
$bStatus = False
EndIf
_checkStatus()
If Not $iArrayNumber >=1 Then
$bStatus = False
EndIf
_checkStatus()
;~ VINT vr_get_device_num (VINT *pnumber);
$sTest = DllCall($hDLL, "int:cdecl", "?vr_get_device_num@@YAHPAH@Z", "int*", $pTest)
If @error <> 0 Then
$bStatus = False
EndIf
_checkStatus()
If IsArray($sTest) and UBound($sTest) >= 2 Then
$iDeviceNumber = $sTest[1]
Else
$bStatus = False
EndIf
_checkStatus()
If Not $iDeviceNumber >=1 Then
$bStatus = False
EndIf
_checkStatus()
;~ ConsoleWrite("$iDeviceNumber = " & $iDeviceNumber & @CRLF)
For $i = 0 To $iArrayNumber-1
$vr_array_info = DllStructCreate("ushort status;ubyte raidType;ubyte diskNum;ulong capacityLow;ulong capacityHigh;ulong realCapacityLow;ulong realCapacityHigh;ulong stripeSize;ulong blockSize;int bNeedMigration;int bNeedInit;int bOptimized;ubyte systemDisk;ushort raid_index;int index")
If @error <> 0 Then
$bStatus = False
EndIf
_checkStatus()
$sTest = DllCall($hDLL, "int:cdecl", "?vr_get_array_info@@YAHHPAU_vr_array_info@@@Z", "int", $i, "struct*", DllStructGetPtr($vr_array_info))
If @error <> 0 Then
$bStatus = False
EndIf
_checkStatus()
$iArrayStatus = DllStructGetData($vr_array_info, "status")
If @error <> 0 Then
$bStatus = False
EndIf
_checkStatus()
If $iArrayStatus == 0 And $bStatus Then
$bStatus = True
Else
$bStatus = False
EndIf
_checkStatus()
Next
For $i = 0 To $iDeviceNumber-1
$vr_device_info = DllStructCreate("char serialNumber[32];char firmwareRevison[16];char modelName[64];char minorRevisonNumber[64];ulong cylinderNumber;ulong headNumber;ulong sectorNumberPerTrack;ulong capacityLow;ulong capacityHigh;ubyte supportPIOTransferMode;ubyte supportMultiDMAMode;ubyte supportUltraDMAMode;ubyte currentTransferMode;ubyte deviceType;ushort status;ubyte ctrler_index;ubyte chan_index;int master;int index;ubyte systemDisk;int bDevInRaid;ushort array_position;int array_index;ulong realCapacityLow;ulong realCapacityHigh")
If @error <> 0 Then
$bStatus = False
EndIf
_checkStatus()
$sTest = DllCall($hDLL, "int:cdecl", "?vr_get_device_info@@YAHHPAU_vr_device_info@@@Z", "int", $i, "struct*", DllStructGetPtr($vr_device_info))
If @error <> 0 Then
$bStatus = False
EndIf
_checkStatus()
$iDeviceStatus = DllStructGetData($vr_device_info, "status")
If @error <> 0 Then
$bStatus = False
EndIf
_checkStatus()
If $iDeviceStatus == 0 And $bStatus Then
$bStatus = True
Else
$bStatus = False
EndIf
_checkStatus()
Next
;~ void vr_exit (void);
$sTest = DllCall($hDLL, "none", "?vr_exit@@YAXXZ")
DllClose($hDLL)
If $bStatus Then
ConsoleWrite("1")
Else
ConsoleWrite("0")
EndIf
Exit
Func _checkStatus()
If Not $bStatus Then
ConsoleWrite("0")
Exit
EndIf
EndFunc

- 112
- 2
- 14
-
And here's the "young DLL tamer kit": http://www78.zippyshare.com/v/3ebn6ig0/file.html – real_sm Jan 17 '17 at 22:16