-2

Can somebody please let me know how we can determine if a local disk or SAN.

Thanks

user70636
  • 1,029
  • 3
  • 12
  • 13

3 Answers3

2

There is no "OS agnostic" way to determine if the file system is back-ended by SAN.

That is, please let us know what OS you're using so we can help determine the OS specific way to determine if this (other than asking your storage administrator).

0

SAN is a Storage Area Network topology incorporated into a physical network topology, it which means that storage is provided for sharing/storing data via the network (usually tcp/ip)...It is similar to NFS (Network File Share), or using the Microsoft specific Server Message Block protocol to designate a share on the server with a drive letter used - Universal Naming Convention where a shared drive is mapped to a drive letter in the form of '\\servername\foo'.

Can you please clarify if that is what you are looking for? How to determine if a drive is mapped to the shared drive such as '\\servername\foo'?

Have a look at this thread here...on mapping drives and disconnecting mapped drives here. And here to check if a path is on a network here.

Edit: Thanks to zombiesheep for the clarification due to my confusion after being told by somebody else during my training for CompTIA Network+ 2009.....duh!

Hope this helps, Best regards, Tom.

Community
  • 1
  • 1
t0mm13b
  • 34,087
  • 8
  • 78
  • 110
  • 1
    Sorry, but a SAN is not normally connected via the network. It is usually connected over fibre-channel directly into a host-bus adapter of some sort in the server. The server is then responsible for utilising the allocated space as it sees fit, either for internal storage, serving over the network, or whatever else. sounds like you're confusing it with NAS (network attached storage) Sorry , ex-HP StorageWorks engineer here. :) – ZombieSheep Mar 02 '10 at 15:49
  • @ZombieSheep: Oh...ok...funny that....I take your word for it...I was studying CompTIA NEtwork+ 2009 earlier on this year and that was I was taught via CBT....would ya believe that...SAN a topology... sigh...Thanks for the heads up I'll correct this somehow... :) – t0mm13b Mar 02 '10 at 15:54
0

Here you go, using C# and WMI. Using this you can type in "enumSANDrives " from a command prompt and it will list them out. You might have to tweak the descriptions a little and manually look at the WMI class through Scriptomatic or something to match up your particular SAN(s).

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.IO; 
using System.Management;
using System.Data.SqlClient;
using Microsoft.Win32;
using System.Net;
using System.Net.NetworkInformation;
using System.Runtime.InteropServices;
using System.Security.Permissions;
using System.Security.Principal;

namespace EnumSANDrives
{
    class Program
    {


        static void Main(string[] args)
        {
            //1. Start with the Win32_DiskDrive class and query for instances of Win32_DiskPartition using the DeviceID property and the 
            //Win32_DiskDriveToDiskPartition association class. Now you have a collection of the partitions on the physical drive.
            //2. Query for the Win32_LogicalDisk that represents the partition using the Win32_DiskPartition.DeviceID property and 
            //Win32_LogicalDiskToPartition association class.
            //3. Get the drive letter from the Win32_LogicalDisk.DeviceID.

            ConnectionOptions connOptions = new ConnectionOptions();
            connOptions.Username = "<username>";
            connOptions.Password = "<pwd>";
            connOptions.Authentication = AuthenticationLevel.Packet; 
            connOptions.Impersonation = ImpersonationLevel.Impersonate;
            connOptions.EnablePrivileges = true;
            ManagementScope manScope = new ManagementScope(String.Format(@"\\{0}\ROOT\CIMV2", machine), connOptions);
            manScope.Connect();
            ObjectQuery oQueryDiskDrive = new ObjectQuery("select * from Win32_DiskDrive");
            ManagementObjectSearcher oSearcherDiskDrive = new ManagementObjectSearcher(manScope, oQueryDiskDrive);
            ManagementObjectCollection oReturnDiskDrive = oSearcherDiskDrive.Get();
            foreach (ManagementObject DiskDrive in oReturnDiskDrive)
            {
                ObjectQuery oQueryDiskPartition = new ObjectQuery("ASSOCIATORS OF {Win32_DiskDrive.DeviceID='" + DiskDrive["DeviceID"] + "'} WHERE AssocClass = Win32_DiskDriveToDiskPartition");
                ManagementObjectSearcher oSearcherDiskPartition = new ManagementObjectSearcher(manScope, oQueryDiskPartition);
                ManagementObjectCollection oReturnDiskPartition = oSearcherDiskPartition.Get();
                foreach (ManagementObject DiskPartition in oReturnDiskPartition)
                {
                    ObjectQuery oQueryLogicalDisk = new ObjectQuery("ASSOCIATORS OF {Win32_DiskPartition.DeviceID='" + DiskPartition["DeviceID"] + "'} WHERE AssocClass = Win32_LogicalDiskToPartition");
                    ManagementObjectSearcher oSearcherLogicalDisk = new ManagementObjectSearcher(manScope, oQueryLogicalDisk);
                    ManagementObjectCollection oReturnLogicalDisk = oSearcherLogicalDisk.Get();
                    foreach (ManagementObject LogicalDisk in oReturnLogicalDisk)
                    {
                        try
                        {
                            //Console.Write("Drive Name : " + LogicalDisk["DeviceID"].ToString());
                            if (DiskDrive["PNPDeviceID"] != null)
                            {
                                if (DiskDrive["PNPDeviceID"].ToString().Contains("VEN_EMC"))
                                {
                                    Console.WriteLine("Drive Name : " + LogicalDisk["DeviceID"].ToString() + " - " + "EMC SAN " + DiskDrive["Model"].ToString());
                                }
                                if (DiskDrive["PNPDeviceID"].ToString().Contains("VEN_IBM"))
                                {
                                    Console.WriteLine("Drive Name : " + LogicalDisk["DeviceID"].ToString() + " - " + "IBM SAN " + DiskDrive["Model"].ToString());
                                }
                                if (DiskDrive["PNPDeviceID"].ToString().Contains("VEN_COMPAQ"))
                                {
                                    Console.WriteLine("Drive Name : " + LogicalDisk["DeviceID"].ToString() + " - " + "HP SAN " + DiskDrive["Model"].ToString());
                                }



                            }
                            //Console.WriteLine("Size : " + BytesToGB(DiskDrive["Size"].ToString()));
                            //Console.WriteLine("Used Space : " + BytesToGB((Convert.ToDouble(DiskDrive["Size"].ToString()) - Convert.ToDouble(LogicalDisk["FreeSpace"].ToString())).ToString()));
                            //Console.WriteLine("Free Space : " + BytesToGB(LogicalDisk["FreeSpace"].ToString()));
                        }
                        catch (Exception)
                        {
                            continue;
                        }
                    }
                }
            }

        }
    }
}
thirtydot
  • 224,678
  • 48
  • 389
  • 349
Quantum Elf
  • 752
  • 4
  • 9