VMFS Datastores – Expand and Extend

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*.

DS-Increase

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

The Increase button

The Increase button in fact offers two different methods to increase the size of a datastore. The definitions of two methods according to the

  • Expand: increases the capacity of an existing VMFS datastore by expanding (increasing the size of) an existing extent of the datastore
  • Extend: Increases the capacity of an existing VMFS datastore by adding new extents to the datastore

Perhaps the following schematic makes it a bit more clear.

vmfs-2

The schematic shows a VMFS datastore with one extent, on LUN A. If we want to increase the Used capacity, we can do an Expand, on the same extent (LUN A). Or we can do an Extend on a new LUN, in this case LUN B.In the case of the Extend, the VMFS datastore will now have two extents, LUN A and LUN B.

Note that for the Expand and the Extent you do not need to use all of the free space. The following is perfectly possible.

vmfs-1

The Increase button presents the user with a series of candidate LUNs. The Expand and Extend candidate LUNs are intermixed in that list. The underlying API method makes sure that the LUNs are not already used by another datastore or by a RDM disk.

The Module

The module is available in my GitHub VMFSIncrease repository.

Sample runs

Reporting

The Get-VmfsDatastoreInfo displays basic information about the extents and the partitions that make up the datastore.

This produces something like this

vmfs-3

The Datastore lives on one extent, and on that extent there are three partitions. The partition marked with (2) is the part where the VMFS Datastore lives. Part (3) is the free space, and part (1) is for alignment.

To check how we can increase the capacity of the Datastore, we can run

This returns something like this

vmfs-4

The returned information shows that there are two options to increase the capacity of the Datastore. In (1) we see that we can Expand the extent by 80GB. In (2) we see that we can Extend the capacity by 100GB by adding a new extent to the Datastore.

Expand

The Help page for the New-VmfsDatastoreIncrease function already contains several examples on how to use the function. But to give you an idea what is possible, just a few examples.

We have the possibility to add up to 80GB. If we don’t specify a size, all the free space on the extent is used.

If we do specify how much we want to increase the capacity, only that specific amount of space from the free space will be taken.

If we have a Datastore that spans more than one extent, we can, through the Canonicalname parameter, indicate on which extent the increase shall be taken.

Extend

As we explained in the beginning of the post, with the Extend switch we indicate that we want to increase the capacity on a new extent. Again we can take the full extent.

Interesting to note, if you don’t specify a LUN, through the Canonicalname parameter, the function will order the available LUNs alphanumerically on their Canonicalname, and take the first one. So the following is perfectly possible, provided of course there are free LUNs available.

And, as with the Expand option, you do not need to use all of the available space with the Extend option. You can control how much space is taken through the IncreaseSizeGB parameter.

The option is also available without specifying a LUN. The function uses the same logic as was mentioned before, it will order the available LUNs alphanumerically on their Canonicalname, and take the first one.

PowerCLI Community Repository

Since a couple of days the long awaited PowerCLI Community Repository is live! More info can be found in the Updating the VMware PowerCLI Community Repository! post over on the PowerCLI Blog.

If you have any scripts, functions, modules… that might be useful for the community, please submit them there.

The VMFSIncrease module will be available on the PowerCLI Community Repository shortly.

 

Enjoy, and share!

 

Leave a Reply

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

*
*

Buy the Book