First of all, there is no a single block size. This is a characteristic if each volume, not of the whole system.
This is not trivial thing at all. I prefer to show how to do it with WMI, because, this way, you can do it in pure C#.
Consider the following code which shows you the block size of each volume:
using System.Management;
ManagementObjectSearcher searcher = new ManagementObjectSearcher("SELECT * FROM Win32_Volume");
ManagementObjectCollection collection = searcher.Get();
foreach (ManagementObject item in collection) {
System.Console.WriteLine("Name: {0}", item["Name"]);
System.Console.WriteLine("Block size: {0}", item["BlockSize"]);
System.Console.WriteLine();
}
How it works?
Look at the class
ManagementObject
:
http://msdn.microsoft.com/en-us/library/system.management.managementobject.aspx[
^].
As you can see, this class provides access to different properties of a run-time management object via the indexed property '[]', indexed by strings. How do you know what property to use?
The class provides reflective API; for example, you can use the property
Properties
(and
Methods
, so you can invoke methods). This class is actually a wrapper over some "real" management objects you can get via a query.
But where to read about the meaning of the properties and method? You can use C++ documentation to get the properties you want. For Win32_Volume, use
http://msdn.microsoft.com/en-us/library/windows/desktop/aa394515%28v=vs.85%29.aspx[
^].
Good luck,
—SA