Getting More Information About You Cluster LUN’s (Part 2 of 3)
So here’s the scenario you need or want to figure out which LUN is which on your cluster…
Yesterday I posted a script which used Get-ClusterParameter and the Physical Disk Private Properties to gather information on the storage being used by the cluster – as promised here’s a less verbose version of that script…
Script
Import-Module FailoverClusters $csv1 = Get-ClusterSharedVolume Cluster_CSV1_IBMXIV $csvParams = Get-ClusterParameter -InputObject $csv1 $DiskUniqueIds = ($csvParams | Where-object -FilterScript {$_.Name -eq "DiskUniqueIds"}).Value $CountOfIdentifiers = $DiskUniqueIds[8] $currentArrayIndex = 12 for($a = 0; $a -lt $CountOfIdentifiers; $a++) { $CodeSet = $DiskUniqueIds[$currentArrayIndex] $Length = $DiskUniqueIds[$currentArrayIndex+8] $NextOffset = $DiskUniqueIds[$currentArrayIndex+10] switch ($DiskUniqueIds[$currentArrayIndex+4]) { 0 {Write-Host "StorageIdType: VendorSpecific";break} 1 {Write-Host "StorageIdType: VendorId";break} 2 {Write-Host "StorageIdType: EUI64";break} 3 {Write-Host "StorageIdType: FCPHName";break} 4 {Write-Host "StorageIdType: PortRelative";break} 5 {Write-Host "StorageIdType: TargetPortGroup";break} 6 {Write-Host "StorageIdType: LogicalUnitGroup";break} 7 {Write-Host "StorageIdType: MD5LogicalUnitIdentifier";break} 8 {Write-Host "StorageIdType: ScsiNameString";break} } switch ($DiskUniqueIds[$currentArrayIndex+12]) { 0 {Write-Host "StorageIdAssoc: Device";break} 1 {Write-Host "StorageIdAssoc: Port";break} 2 {Write-Host "StorageIdAssoc: Target";break} } $Data = $null switch($CodeSet) { 2 { #StorageIdCodeSetAscii $DiskUniqueIds_ptr = [System.Runtime.InteropServices.Marshal]::UnsafeAddrOfPinnedArrayElement($DiskUniqueIds, $currentArrayIndex+16) $Data = [System.Runtime.InteropServices.Marshal]::PtrToStringAnsi($DiskUniqueIds_ptr, $Length) break } 3 { #StorageIdCodeSetUtf8 $DiskUniqueIds_ptr = [System.Runtime.InteropServices.Marshal]::UnsafeAddrOfPinnedArrayElement($DiskUniqueIds, $currentArrayIndex+16) $Data = [System.Runtime.InteropServices.Marshal]::PtrToStringUni($DiskUniqueIds_ptr, $Length) break } default { #0=StorageIdCodeSetReserved, 1=StorageIdCodeSetBinary for($x = ($currentArrayIndex+16); $x -lt ($currentArrayIndex + 16 + $Length); $x++) { $Data += , $DiskUniqueIds[$x] } break } } Write-Host "Data: " $Data $currentArrayIndex+=$NextOffset Write-Host } |
Sample Output
Windows PowerShell Copyright (C) 2009 Microsoft Corporation. All rights reserved. PS C:\Users\taylorb>.\GetCSVDevInfo1.ps1 StorageIdType: EUI64 StorageIdAssoc: Device Data: 0 23 56 0 1 19 0 28 StorageIdType: VendorId StorageIdAssoc: Device Data: IBM 2810XIV 1300113001C StorageIdType: VendorSpecific StorageIdAssoc: Device Data: vol=CSV_1 StorageIdType: VendorSpecific StorageIdAssoc: Device Data: host=37-4611K2713K StorageIdType: TargetPortGroup StorageIdAssoc: Port Data: 0 0 0 0 StorageIdType: PortRelative StorageIdAssoc: Port Data: 0 0 7 1 |
Taylor Brown Hyper-V Enterprise Deployment Team taylorb@microsoft.com https://blogs.msdn.com/taylorb |