1

I need to access the type of disk and display it in the C# code. In this image " Local Disk Image" the type is local disk. In this image "Cluster Disk Image" the type of disk is cluster disk.

I have used driveInfo class to get the drive details. but I'm not able to display whether the drive is cluster or local disk. d.DriveType returns whether it is a removable or fixed types. and not the required local disk or cluster type. My code is added below:

DriveInfo[] allDrives = DriveInfo.GetDrives();
foreach (DriveInfo d in allDrives)
{
Console.WriteLine("Drive {0}", d.Name);
Console.WriteLine("  Drive type: {0}", d.DriveType);
if (d.IsReady == true)
{
    Console.WriteLine("  Volume label: {0}", d.VolumeLabel);
    Console.WriteLine("  File system: {0}", d.DriveFormat);
    Console.WriteLine(
        "  Available space to current user:{0, 15} bytes", 
        d.AvailableFreeSpace);

    Console.WriteLine(
        "  Total available space:          {0, 15} bytes",
        d.TotalFreeSpace);

    Console.WriteLine(
        "  Total size of drive:            {0, 15} bytes ",
        d.TotalSize);
}
}

Is there any way to display the required info in C# code?

Thank you.

0 Answers0