How to expand VMFS datastore from the command line (CLI) on vSphere 5.x and 6.x?

By | August 28, 2015

Today I needed to expand a datastore on my nested ESXi 5.5 in my lab. Unfortunately when I resized a VMDK for my ESXi host, I was not able to expand the datastore via Web Client - because no additional space was available! How to expand VMFS datastore from the command line (CLI) on vSphere 5.x and 6.x I did not to want to install again vSphere Client (I know that expanding works under it) 5.5 because already 6.0 installed is not compatible with 5.5. I decided to expand disk via CLI on ESXi host.

Expanding VMFS datastore can be divided into two phases:

  1. Recreating the partition layout to accommodate the larger file system.
  2. Growing the Datastore to fill the larger partition.

In general, we need to use two magic tools: vmkfstools and partedUtil 😉

To change partition layout to accommodate the larger file system we need to do the below steps:

    1. Obtain the device identifier for the Datastore to be modified.

      vmkfstools -P /vmfs/volumes/Datastore_name

    2. Use partedUtil to check existing partition on VMFS volume (should be one partition).

      partedUtil get "/vmfs/devices/disks/mpx.vmhbax:Cx:Tx:Lx"

    3. Use partedUtil to get usable sectors and resize parition.

      partedUtil getUsableSectors "/vmfs/devices/disks/mpx.vmhbax:Cx:Tx:Lx"

      partedUtil resize "/vmfs/devices/disks/mpx.vmhbax:Cx:Tx:Lx" PartitionNumber NewStartingSector NewEndingSector

    4. Refresh VMFS volumes using the command:

      vmkfstools -V

    5. Grow the VMFS Datastore in to the new space using the command below:

      vmkfstools --growfs "/vmfs/devices/disks/mpx.vmhbax:Cx:Tx:Lx:partition" "/vmfs/devices/disks/mpx.vmhbax:Cx:Tx:Lx:partition"

      An example is shown on the below figure. As you can see, it is important to use double dash... 😉How to expand VMFS datastore from the command line (CLI) on vSphere 5.x and 6.x

    For more information please follow VMware KB.

One thought on “How to expand VMFS datastore from the command line (CLI) on vSphere 5.x and 6.x?

  1. Petrovich

    Thanks a lot, man!
    spent a about two weeks while trying to increase storage size, adn found answer here :)).
    That's was so simply, i just didn't do the last step - vmkfstools --growfs.
    Here i read correct sequence and do, and everything is ok.
    thanks!

    Reply

Leave a Reply

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