Mapping a Cluster Shared Volume to the Physical Disk

Mapping a Cluster Shared Volume to the Physical Disk

  • Comments 2
  • Likes

Cluster Shared Volumes is a new feature of Windows Server 2008 R2 Failover Clustering intended to enhance the capabilities of Highly Available Virtual Machines. It is recommended to utilize Cluster Shared Volumes if you intend to use the Live Migration feature of Windows Server 2008 R2 Hyper-V. In this blog I would like to provide a simple PowerShell script to enumerate the current list of Cluster Shared Volumes (CSV) mapping to the physical disk on which the volume resides.


Failover Cluster Manager provides the below information about where the CSV is mounted in the local file system of each node of the cluster.


Figure 1

clip_image002

 

Disk Management displays the list of Physical Disks but does not contain information about where the disk is mounted as a CSV.


Figure 2

clip_image004

 

The attached script will enumerate the CSV resources in the cluster and map them to the actual Physical Disk.


Sample script output:

Cluster Shared Volumes mapped to Physical Disks
===============================================
Name                       CSVPath                    PhysicalDisk            
----                       -------                    ------------            
Cluster Disk 3             C:\ClusterStorage\Accnt... Physical Disk 4         
Cluster Disk 4             C:\ClusterStorage\Volume1  Physical Disk 5
 

Sample script:

#
Import-Module FailoverClusters

$objs = @()

$csvs = Get-ClusterSharedVolume
$n = 1
Echo "Cluster Shared Volumes mapped to Physical Disks" > C:\Windows\Cluster\Reports\CSVtoDiskMap.txt
Echo =============================================== >> C:\Windows\Cluster\Reports\CSVtoDiskMap.txt
Echo `n"Collecting cluster resource information..."
foreach ( $csv in $csvs )
    {
    Echo "Processing Cluster Shared Volume $n"
    $Signature = ( $csv | Get-ClusterParameter DiskSignature ).Value.substring(2)
        $obj = New-Object PSObject -Property @{
            Name          = $csv.Name
            CSVPath       = ( $csv | select -Property Name -ExpandProperty SharedVolumeInfo).FriendlyVolumeName
            PhysicalDisk  = ( Get-WmiObject Win32_DiskDrive | Where { "{0:x}" -f $_.Signature -eq $Signature } ).DeviceID.substring(4)
        }
    ($obj).PhysicalDisk = ($obj).PhysicalDisk -Replace "PHYSICALDRIVE", "Physical Disk "
    $objs += $obj
    $n++
    }
Echo `n"Output file: C:\Windows\Cluster\Reports\CSVtoDiskMap.txt"`n
$objs | FT Name, CSVPath, PhysicalDisk >> C:\Windows\Cluster\Reports\CSVtoDiskMap.txt
notepad C:\Windows\Cluster\Reports\CSVtoDiskMap.txt

Feel free to take this “as is” and modify it as you need. Play with the output... I am still tweaking to get a more pleasing output myself.

 

How to collect additional information using PowerShell:

PowerShell for Failover Clustering: CSV Free Disk Space (and other info)

Chris Allen
Senior Support Escalation Engineer

Microsoft Enterprise Platforms Support

Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment
  • Is there anyway of doing this for GPT disks?  The signature property is blank for GPT disks.  I've been banging my head on my desk for days now

  • Hi Chris, I've been looking for this.. can u post this using C# and WMI or atleast May I know how to embed the code and results to a object variable using SSIS