无法检索群集可用存储的物理大小 [英] Unable to retrieve physical size of available storage for cluster
问题描述
我的工作已经进行到一半,现在卡住了。
I am half way down with my work and now stuck.
我正在尝试获取有关群集的可用存储设备的信息。
我能够获取可用存储设备的列表,但无法检索这些可用存储的物理磁盘,可用空间等。
I am trying to fetch information about available storage devices for a cluster. I am able to fetch the list of available storage devices but unable to retrieve the physical disk, available free space, etc of these available storage.
我想要像这样。是否有任何命令可以从群集磁盘名称中获取物理磁盘名称,或者可以直接获取磁盘详细信息。
对于共享磁盘,我可以检索详细信息( Get-ClusterSharedVolume ),但不适用于非共享磁盘。
我想要执行powershell或WMI脚本。
I want like this. Is there any command to fetch physical disk name from Cluster Disk Name or directly can I get the disk details. For Shared Disk I am able to retrieve the details (Get-ClusterSharedVolume) but not for a non-shared disk. I want powershell or WMI script for doing so.
推荐答案
您可以从WMI获取此信息,但需要执行以下几个步骤:
You can get this information from WMI, but it takes a couple steps:
$resources = Get-WmiObject -namespace root\MSCluster MSCluster_Resource -filter "Type='Physical Disk'"
$resources | foreach {
$res = $_
$disks = $res.GetRelated("MSCluster_Disk")
$disks | foreach {
$_.GetRelated("MSCluster_DiskPartition") |
select @{N="Name"; E={$res.Name}}, @{N="Status"; E={$res.State}}, Path, VolumeLabel, TotalSize, FreeSpace
}
} | ft
这将为您提供如下输出:
That will give you output like the following:
Name Status Path VolumeLabel TotalSize FreeSpace
---- ------ ---- ----------- --------- ---------
Cluster Disk 2 2 K: New Volume 5220 5163
SQL - FAS3070 SiteB 2 S: MC_SQL 5597 5455
SM Test 2 M: SM Test 1024 992
DTC - FAS3070B 2 F: MC_WITNESS 5346 5289
Cluster Disk Witness 2 E: New Volume 5322 5267
Cluster Disk 1 2 G: MC_DTC 5088 5035
Cluster Disk 3 2 T: SQL 5119 4999
如果您不关心资源名称/状态,您可以跳过这些步骤而直接跳到分区(它将运行得更快):
If you don't care about the resource name/status you can skip those steps and jump straight to the partition (and it'll run much quicker):
gwmi -namespace root\MSCluster MSCluster_DiskPartition | ft Path, VolumeLabel, TotalSize, FreeSpace
编辑:请注意,大小以MB为单位,状态为 2表示磁盘处于联机状态。
Note that the size is in MB and a Status of "2" means that the disk is online.
这篇关于无法检索群集可用存储的物理大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!