1

I was looking around for a tool to monitor the status of my software raid under Windows 2003 Server, but couldn't find anything suitable (i.e. not grossly oversized or needlessly complicated). So I decided to just do it myself, it's nothing spectacularly difficult.

So how can I retrieve the status of the volumes programmatically? It's been a while since I fiddled with the Windows API and I couldn't find anything right off the bat using Google. I know I can use diskpart /s and parse its output, but that gets messy fairly quickly (although it does have some advantages).

Any pointers into the right direction are highly appreciated :)

4 Answers 4

2

The Win32 API is the (apparently only) way to go here, Virtual Disk Service is the magic word.

Here is a good example in C++ that will get you started. The number of different COM interfaces was pretty confusing for me at first, but the How Virtual Disk Service Works article was of great help getting the big picture.

It's actually pretty easy. Despite never having done any serious C++ coding and never having even touched COM before, I was still able to get the basic functionality to work in a few hours.

Sign up to request clarification or add additional context in comments.

1 Comment

Thats maybe not the only way, it is the best way, and also what diskpart is using under the hood.
0

Did you check WMI?

You can take a look here for a demo.

1 Comment

WMI doesn't return the raid status (see anchor.com.au/hosting/dedicated/…)
0

You could try monitoring the Event log for RAID events.

1 Comment

Yes, that's another option (see one of my links above). I'd rather query the status directly, though.
0

I don't know if RAID stuff will complicate matters, but I've used System.IO.DriveInfo.GetDrives() before and that's worked fine for my needs.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.