Getting Free Space from your EMC Storage Array (CX, VNX)

Before you start reading this post let me throw out a few caveats:

  • This will only get you the free space of your RAID Groups (going to work on Pools next)
  • I’ve only tested this on an EMC Clariion (CX4-480), but it should work with VNX as long as you’re using RAID Groups

If you’re good with the two caveats above, let’s get into it.

About every 2 months or so someone comes and asks me how much free space to we have on our SAN at site x?  Or the question is “I need 1TB of FC space at every site, do we have it?”  If I only had one SAN to look at I would just go into Unisphere and look at the free space, but who wants to log into 34 SANs and check?  I don’t, but that is what I did the first few times I was asked this question.  Finally after the third time I told myself there has to be an easier way; off to the internets I went.

I found a solution pretty quick from none other than vSpecialst Clint Kitson (blog, twitter) of EMC who had written some powershell scripts that leveraged NaviCLI to get the information I was looking for.  Those scripts can be found here, but keep in mind you need NaviCLI installed on your system or none of this will work.  NavilCLI can be found on EMC’s Powerlink site.

It did take me a little bit of time to figure out exactly how Clint was storing the data he pulled into Powershell, but eventually I was able to wade my way through a river of hashtables and pull the information I needed.

Here is the script:

 

You’ll now have a .CSV file in the same location as the script you just ran with a name of “SAN_free_space.csv” and here is what it will look like

image

To sum up a list of things you’ll need:

  1. Latest version of NaviCLI installed on a system (get this from Powerlink if needed)
  2. Clint Kitson’s Powershell scripts to gather the data from your EMC SAN
    1. exec_naviseccli_cmd.ps1
    2. get_naviseccli.ps1
  3. My script to parse out the data (right-click, save as); get-freesanspace.ps1 (rename from .txt to .ps1)

I want to give a BIG thanks to Clint Kitson for taking the time to write those two scripts to bring all of that data into Powershell.  I would undoubtedly still be working on this if it hadn’t been for him.  So Clint, I definitely owe  you a beer or two!

If you have any issues getting this to work please don’t hesitate to contact me.

*UPDATE – 03/29/12*

I updated the script to also check for unbound space. Now this is looking for drives that are “Fibre Channel” and “SATAII” so if you are trying to interrogate a VNX you will need to change those values to represent “SATA Flash”, “SAS” and “NL SAS”.  In the unbound area I also told the script to skip the first 5 drives on Bus 0 Enclosure 0 since those are the OS disks and I don’t care about unbound space on the OS disks.  I believe on the VNX it is using the first 4 disks so you may want to change that.  I’ve also added the RAID type for the RAID groups and finally I added a line that reflected total SAN space.  The script and screenshots are updated above

Comments 10

  1. I am running your script and I get 0gb free on all raid groups. I am on VNX and I did change all Fibre Channel to SAS and all SATAII to NL SAS. Also how hard would it be to include Storage Pools?
    Thanks,
    Ron

    1. Post
      Author

      Hi Ron,

      Sorry for the delayed reply. I’m assuming that you have RAID groups, but they are all showing 0GB? What data gets returned, do you see any unbound data? To be honest I haven’t ran it against a VNX, so there may be some other modifications that need to be made. I imagine including storage pools wouldn’t be all that difficult, but I don’t have access to an array that is leveraging pools at the moment However, I am working on that and hope to have something soon. I’ll let you know what I come up with.

      -Josh

    1. Post
      Author
  2. I’ve added ‘[int32]$intfreespace=0’
    just before ‘foreach ($fdisk in $ubound)’
    otherwise my unbound fc was displaying ‘ GB’

    I’ve also defined ‘$usesecfile = $true’ with the logic around ‘$user’, ‘$pass’, and ‘Invoke-Expression’ so I can expedite the script.

    Thanks for building onto Clint’s scripts.

    Works on CX4-120 FLARE 4.30.000.5.525
    Will try VNX and VNXe later

  3. Have you seen good tools to monitor and graph the disk space used on a monthly or weekly basis? (other than running the script every month and manually updating an Excel sheet).

    1. Post
      Author

      Hey Clay,

      Not really, but to be honest, I haven’t looked either. If you have the storage analyltics adapter from EMC and vCenter Operations Advanced or better you can get a TON of information out of there and should be able to see that type of information.

  4. This is spectacular but I’m seeing RAID groups reporting 0GB when there is 400GB free. Also I have RAID groups all with unbound disks reporting 0GB. This is being run against a CX4-120 – FLARE 4.29.000.5.003

    1. Post
      Author
  5. I really appreciate these scripts. I am also getting 0 GB of free space on all Raid groups. It only shows the space on unbound disk. I am using this on a CX3-20 flare code 3.22 and a CX4-120 flare code 4.29. I noticed other users with the same issue. What was the resolution?

Leave a Reply to Josh Coen Cancel reply

Your email address will not be published. Required fields are marked *

*