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! 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:
- Recreating the partition layout to accommodate the larger file system.
- 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:
-
Obtain the device identifier for the Datastore to be modified.
vmkfstools -P /vmfs/volumes/Datastore_name
-
Use partedUtil to check existing partition on VMFS volume (should be one partition).
partedUtil get "/vmfs/devices/disks/mpx.vmhbax:Cx:Tx:Lx"
-
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
-
Refresh VMFS volumes using the command:
vmkfstools -V
-
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... 😉
For more information please follow VMware KB.