How to report the size of a cluster shared volume in PowerShell?

Hinterleitner Andreas 0 Reputation points
2023-08-10T13:17:49.03+00:00

I need to know the size of Azure Stack HCI cluster shared volumes, and because I found no better command, I started with:

$a = get-clustersharedvolume -cluster 'clu' -name 'vol'
$a | format-list -property *

One of the properties I think is the one that may hold the info I need:

SharedVolumeInfo: {Microsoft.FailoverClusters.PowerShell.ClusterSharedVolumeInfo}

To me, it looks like this property has properties by itself (nested object; curly braces?); 'cause like to see those, I tried:

$a | select-object -expandproperty sharedvolumeinfo | format-list -Property *

but this only gives me:

Microsoft.FailoverClusters.PowerShell.ClusterSharedVolumeInfo

I tried several other command sequences but so far was unable to get a list of sharedvolumeinfo's properties. Whatever my mistake is, I hope some expert can help me.

Azure Stack HCI
Azure Stack HCI
A hyperconverged infrastructure operating system delivered as an Azure service that provides security, performance, and feature updates.
342 questions
Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,522 questions
{count} votes

4 answers

Sort by: Most helpful
  1. Michael Durkan 12,201 Reputation points MVP
    2023-08-10T16:20:06.3466667+00:00

    Hi

    see link below, Cosmos Darmin (Azure Stack HCI PM) wrote this script a few years ago that gives full details and usage:

    https://techcommunity.microsoft.com/t5/storage-at-microsoft/deep-dive-volumes-in-storage-spaces-direct/ba-p/425807

    Hope this helps,

    Thanks

    Michael Durkan

    • If the reply was helpful please upvote and/or accept as answer as this helps others in the community with similar questions. Thanks!
    0 comments No comments

  2. Trent Helms - MSFT 2,541 Reputation points Microsoft Employee
    2023-08-22T13:18:45.0433333+00:00

    Hi,

    Try this...

    #Get the name of the CSV as shown from the output of Get-ClusterSharedVolume and enter it into the command below
    
    (Get-ClusterSharedVolume -Name "Name of CSV").SharedVolumeInfo.Partition
    

    In my sample output from below, this provides the Size, UsedSpace, FreeSpace and PercentFree of the CSV.

    PS C:\> (Get-ClusterSharedVolume -Name "Cluster Virtual Disk (Volume01)").SharedVolumeInfo.Partition
    
    DriveLetter            :
    DriveLetterMask        : 0
    FileSystem             : CSVFS
    FreeSpace              : 3741753348096
    HasDriveLetter         : False
    IsCompressed           : False
    IsDirty                : Unknown
    IsFormatted            : True
    IsNtfs                 : False
    IsPartitionNumberValid : True
    IsPartitionSizeValid   : True
    MountPoints            : {}
    Name                   : \\?\Volume{58899ffb-65f7-47cb-a460-e131564cb4cd}\
    PartitionNumber        : 2
    PercentFree            : 34.03125
    Size                   : 10995049168896
    UsedSpace              : 7253295820800
    

    Hope this helps!

    0 comments No comments

  3. Hinterleitner Andreas 0 Reputation points
    2023-08-29T07:03:59.89+00:00

    Didn't work. For me, SharedVolumeInfo has no property Partition.

    In fact, my main issue is that I hardly found a way to 'look into' SharedVolumeInfo. That's what i tried:

    get-clustersharedvolume -cluster 'cl1' -name 'vol1' | get-member -name SharedVolumeInfo | Format-List -Property *
    

    Result:

    TypeName : Deserialized.Microsoft.FailoverClusters.PowerShell.ClusterSharedVolume

    Name : SharedVolumeInfo

    MemberType : Property

    Definition : Deserialized.System.Collections.ObjectModel.Collection`1[[Microsoft.FailoverClusters.PowerShell.ClusterSharedVolumeInfo,

    Microsoft.FailoverClusters.PowerShell, Version=10.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]] {get;set;}

    get-clustersharedvolume -cluster 'atndfhcicl01' -name 'datastore01' | select-object -ExpandProperty SharedVolumeInfo
    
    

    Result:

    Microsoft.FailoverClusters.PowerShell.ClusterSharedVolumeInfo

    (get-clustersharedvolume -cluster 'atndfhcicl01' -name 'datastore01').SharedVolumeInfo.psobject
    

    Result:

    Members : {int Capacity {get;set;}, int Count {get;}, bool IsFixedSize {get;}, bool IsReadOnly {get;}…}

    Properties : {int Capacity {get;set;}, int Count {get;}, bool IsFixedSize {get;}, bool IsReadOnly {get;}…}

    Methods : {get_Capacity, set_Capacity, get_Count, get_IsFixedSize…}

    ImmediateBaseObject : {Microsoft.FailoverClusters.PowerShell.ClusterSharedVolumeInfo}

    BaseObject : {Microsoft.FailoverClusters.PowerShell.ClusterSharedVolumeInfo}

    TypeNames : {Deserialized.System.Collections.ObjectModel.Collection`1[[Microsoft.FailoverClusters.PowerShell.ClusterSharedVolumeInf

    o, Microsoft.FailoverClusters.PowerShell, Version=10.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]],

    Deserialized.System.Object}

    This is what I found shows me the 'contents' of SharedVolumeInfo:

    (get-clustersharedvolume -cluster 'atndfhcicl01' -name 'datastore01').sharedvolumeinfo.psobject.members
    

    That gives me properties like Capacity, Count, IsReadOnly etc. and several methods. None of them returns something I could use, Capacity for example gives '4'.

    I gave up at that point and started to experiment with storage-related cmdlets. From what I've seen so far, this should work for me.

    The question that remains for me is this 'mysterious' SharedVolumeInfo property. I was so far unable to extract more info out of it, like its properties, or what exactly this type is, by using 'regular' methods. As a workaround, I leveraged psobject, but I'm not enough expert to tell why this workaround seems to be able to do what I want and yield information about the 'contents' of SharedVolumeInfo...


  4. Hinterleitner Andreas 0 Reputation points
    2023-08-30T07:04:41.46+00:00

    Thank you for your clarification. The cluster nodes indeed report Windows 2019, so I understand some PowerShell features are missing.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.