2010-03-02 34 views
-1

有人可以请让我知道我们如何能如果在本地磁盘或SAN确定。确定驱动器是SAN

由于

+2

为什么这个标记为SQL服务器?听起来更像是一个ServerFault.com的东西 – 2010-03-02 15:46:46

回答

0

SAN被并入到一个物理网络拓扑中的存储区域网络 拓扑结构,它 这意味着提供了存储用于共享/经由网络(通常是TCP/IP)存储数据...这与NFS(网络文件共享)类似,或者使用Microsoft特定的服务器消息块协议在服务器上指定共享并使用驱动器盘符 - 通用命名约定,其中共享驱动器映射到驱动器盘符的形式为' \\服务器\富”。

能否请您澄清,如果这是你在找什么?如何确定驱动器是否映射到共享驱动器,如'\\ servername \ foo'?

看一看这个线程在这里...在映射驱动器和断开映射驱动器here。在这里检查路径是否在网络here上。

编辑:由于zombiesheep的澄清,由于我的困惑我对参加CompTIA Network + 2009年训练期间由他人被告知后.....咄!

希望这会有所帮助, 最好的问候, 汤姆。

+1

对不起,但SAN通常不通过网络连接。它通常通过光纤通道直接连接到服务器中的某种主机总线适配器上。然后,服务器负责根据其认为合适的方式使用分配的空间,无论是内部存储,网络服务还是其他任何服务。听起来像是你将它与NAS(网络附加存储)混淆起来对不起,前惠普StorageWorks工程师在这里。 :) – ZombieSheep 2010-03-02 15:49:19

+0

@ZombieSheep:哦......好的......有趣的是......我接受你的话......今年早些时候我正在学习CompTIA网络+ 2009年,那是我通过CBT教的...... 。你会相信... SAN的拓扑...感叹...感谢您的领导,我会纠正这个不知何故... :) – t0mm13b 2010-03-02 15:54:16

2

没有“OS不可知”的方式来确定文件系统是通过SAN回结束。

也就是说,请让我们知道你使用的是什么操作系统,所以我们可以帮助确定特定操作系统的方式来确定此(除了要求存储管理员)。

+0

我有同样的问题,我想对*​​ nix框。你可以请教我吗?谢谢。 – kolslorr 2011-03-31 03:28:44

0

在这里你去,用C#和WMI。使用这个你可以从命令提示符输入“enumSANDrives”,它会列出它们。您可能需要稍微调整一下描述,然后通过Scriptomatic或其他方式手动查看WMI类,以匹配您的特定SAN。

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; 
         } 
        } 
       } 
      } 

     } 
    } 
} 
相关问题