Find All Disconnected Volumes

Updates
5/2/2017 – Added size of disconnected volume output.
5/1/2017 – Fixed bugs.

There are many ways to determine what volumes are connected to a host or host group, but there is no way to easily see via the PowerShell SDK what volumes are disconnected/unused.

PowerShell:

Output examples:

The below results are from Get-PfaVolumes, Get-PfaHosts and Get-PfaHostVolumeConnections results to compare. All of the bold/underline highlights are the volumes that are disconnected.

Download the script from https://github.com/barkz/PurePowerShellGuy.

Cheers,
Barkz

  • Mamo

    Hi,

    We have only 1 disconnected volume, when we execute the above script, it shows 2 disconnected volumes. Also we have 21 volumes in our array, it shows “Disconnected volumes (2 of 193)

    Please help

    -Madhusudan

    • Barkz

      Hi Madhusudan –

      I have fixed the issue in the script. Thanks for posting your comment and helping to make the script better for other customers.

      The issue was related to the hash table I created was 0 based and I did not account for that with the tally. Secondly, when I retrieved the the volumes I did not account for volumes that were connected to Host Groups. So when a volume would be connected to each host of a host group it would add that into the hash table each time.

      Thanks,
      Barkz

      • Mamo

        Hi Barkz,

        Thanks for your update, Now is working as expected. How can I get size of the disconnected volume in the output.

        Thanks
        Madhusudan

        • Barkz

          Hi Madhusudan –

          I have added the size of the disconnected volumes. If you have any further requests please added them to the issues tracker on GitHub (https://github.com/PureStorage-OpenConnect/powershell-toolkit/issues). I will be adding this as a cmdlet to the PowerShell Toolkit.

          Thanks,
          Barkz

          • Mamo

            Thank you very much for your quick response and help.