This article provides information on how to expand a local datastore which also happens to be the boot location of the ESXi host. This is achieved by growing an existing VMFS Datastore in a Primary partition to fill the adjacent available space on the local boot device.
Note: Datastore extents within Primary partitions on a Local or Boot storage device cannot be grown into adjacent space using the GUI and would need to be performed over the command line only. Prior to expanding the local datastore, ensure to verify and validate the following:
This article assumes that the underlying storage volume has already had its capacity increased from the hardware perspective, possibly by adding additional disk to a RAID set. For more information, engage your hardware vendor.
A Datastore's partitions can only be grown into contiguous adjacent space on the disk. Ensure that the partitions in question are at the end of the disk.
Warning: Be very careful to not overlap the any Primary and Logical partitions. This could result in data loss.
Symptoms:
Expanding the local datastore on the ESXi host fails.
You receive this error message similar to:
Failed to expand VMFS datastore datastore1 - Cannot change the host configuration.
Environment
VMware vSphere ESXi 6.5
VMware vSphere ESXi 6.7 VMware vSphere ESXi 7.0.x
VMware vSphere ESXi 8.0.x
Resolution
On the ESXi host containing the local datastore you want to expand:
Open an SSH session and log in as root.
Identify the boot location of the ESXi host by running running this command:
ls -ltrh
Ensure that the symbolic link (symlink) is reflecting in a blue color.
Note: If the symlink is a red color, this indicates connectivity issues to the underlying device and may not be readable or accessible.
Obtain the device identifier for the Datastore (For example: naa, mpx, eui, vml etc.) to be modified by running this command:
Note: The next steps use mpx.vmhbaX:CX:TX:LX as an example. Replace mpx.vmhbaX:CX:TX:LX with your device identifier that may begin differently. For example, naa or eui.
Resize the partition containing the target VMFS Datastore using the partedUtil resize command, specifying the existing starting sector of the partition and the desired ending sector:
Note: The New Ending Sector here would be 1 sector less than output of the total usable sector obtained in the previous step 7. New Ending sector > 16879000-1=16878999.
For example, to resize the Primary partition 3, run this command:
Note: If the partedUtil resize command fails with this error:
The kernel was unable to re-read the partition table on /dev/Device (Device or resource busy).
Reboot the ESXi host before proceeding with the next step.
Grow the VMFS Datastore in to the new space using the vmkfstools --growfs command, specifying the partition containing the target VMFS Datastore twice.
Execute to perform a refresh of the VMFS volumes by running this command:
vmkfstools -V
Validate that the size of the VMFS Datastore has increased by running this command:
df -h
Note: The size of the VMFS Datastore can be cached by hostd and vCenter Server, or any connected client. Click the Refresh button in the vSphere Client to update the Datastore capacity and usage.