We all know, and love, PowerCLI‘s New-Datastore and Set-Datastore cmdlets to create and manipulate VMFS datastores. But when we look at the functionality available through the Web Client, there is one interesting feature for manipulating VMFS datastores that is missing from the PowerCLI cmdlets. The Increase button, which allows us to Expand or Extend an existing VMFS datastore*.

Recently there were a couple of threads on this subject in the VMTN PowerCLI Community, so I decided to streamline my quick-and-dirty scripts into something more presentable, and create a PowerShell module to bundle the functions. I present the VMFSIncrease module!
The VMFSIncrease module will also be my first contribution to the PowerCLI Community Repository! More on that further on in this post.

* The expand and extend functions for a VMFS datastore depend on the availability of free space on the VMFS datastore extents and/or the availability of free LUNs

Another post that comes from a VMTN PowerCLI Community question. Jeff wanted to find the free SCSI LUNs in his environment.
While answering that thread I was amazed there was no PowerCLI function written yet to provide this functionality. At least that was what my friend Google told me 😉

Since there exists a SDK method that makes retrieving free SCSI LUNs quite easy, the function I came up with isn’t too complex.

But it should help you in further automating the setup of your datastores.

Buried in the massive amount of new features introduced with vSphere 5 there are several new API methods on the HostStorageSystem managed object.

Two of these API methods will allow you to automate the new Attach/Detach LUN feature from the vSphere Client. It concerns the AttachScsiLun and DetachScsiLun methods. Until this new feature is available natively in PowerCLI, you can use the following functions.

An interesting question arrived in my mailbox this morning. Robert wanted to know what was the most efficient way to create a new property, called lunID, for the objects returned by the Get-ScsiLun cmdlet.

The new property had to show the lunID, as it is returned in the LUN column in the vSphere client.

A quick post that is triggered by a tweet from @GernotNusshall I saw passing today. He wanted to know how to find the maximum IOPS values over the last 5 minutes for a number of VMs. The IOPS values are readily available from the vSphere statistics but the problem is that the values are returned as summation values over the measuring interval and that you have a read and a write value.

When you are running multi-node vSphere clusters, you probably already had the experience that one or more of your LUNs were not visible on all nodes. Now you can try to find out which LUN is missing on which node the hard way through the vSphere client. Or you can use the force of PowerCLI and run a script that will report all this in a handy spreadsheet.

To make the script as flexible as possible it should be able to handle any n-node cluster. And as you some of you might know, the Export-CSV cmdlet has some problems with variable length rows. Luckily there is a handy solution I already used in my yadr – A vDisk reporter post.