Expanding a VMFS partition seems like an easy task – most of the time all we need to do is go to the storage tab of an ESXi host and use the “Increase Capacity” wizard. There is however one exception to that; the boot drive. As you probably know, you are allowed to have a datastore on the drive hosting the ESXi internal OS files (boot record, drivers etc.). The problem comes up when you try to use the GUI (be it ESXi web console or vSphere) to expand it – the system just won’t allow you to do that.

The workaround to this is rather simple – all you have to do is use my beloved CLI!

To begin, connect to shell on an ESXi host on which you need to expand the boot datastore.

jumpbox@paulwilk.net > ssh root@swzesx01.wilks.lab

After getting the SSH access, run the following command to get the details about the datastore you want to expand:

root@swzesx01.wilks.lab > vmkfstools -P "/vmfs/volumes/

Replace the DatastoreName with the actual name assigned to that datastore on your ESXi.

root@swzesx01.wilks.lab > vmkfstools -P "/vmfs/volumes/

VMFS-6.82 file system spanning 1 partitions. File system label (if any): SWZESX01DS01 Mode: public Capacity 34896609280 (33280 file blocks * 1048576), 2131755008 (2033 blocks) avail, max supported file size 70368744177664 UUID: 5b18e63b-cc64aa19-325c-000c2916af3d Partitions spanned (on "lvm"): mpx.vmhba1:C0:T0:L0:3 Is Native Snapshot Capable: NO

Note down the partition identifier from the output, we are going to use it later on (obviously, your identifier might differ from the one in the example).

Next, we need to gather some data about the current partition table. To get that, run the following command. The bolded part is the disk identifier which we can get by removing the last digit from the partition identifier. In my example it is mpx.vmhba1:C0:T0:L0</span> (notice the lack of :3)

root@swzesxi01.wilks.lab > partedUtil get /vmfs/devices/disks/mpx.vmhba0:C0:T0:L0

Error: The backup GPT table is not at the end of the disk, as it should be. This might mean that another operating system believes the disk is smaller. Fix, by moving the backup to the end (and removing the old backup)? Warning: Not all of the space available to /dev/disks/mpx.vmhba1:C0:T0:L0 appears to be used, you can fix the GPT to use all of the space (an extra 20971520 blocks) or continue with the current setting? This will also move the backup table at the end if is is not at the end already. diskSize (104857600) AlternateLBA (83886079) LastUsableLBA (83886046) NewLastUsableLBA (104857566)
6527 255 63 104857600
1 64 8191 0 128 5 8224 520191 0 0
6 520224 1032191 0 0 7 1032224 1257471 0 0 8 1257504 1843199 0 0 9 1843200 7086079 0 0 2 7086080 15472639 0 0 3 15472640 83886046 0 0

Ok, that’s a lot of info. Let’s break that down and identify what do we need for the next steps:

  • NewLastUsableLBA (104857566) – this bit provides us with the last sector number on the drive
  • 3 – this is the partition number for the partition which we will expand
  • 15472640 – lastly, this number indicates the first sector used by our partition

Having all of that noted down, we can move on to the next step – expanding the VMFS. To achieve that, we need to run the following command:

root@swzesx01.wilks.lab > partedUtil resize "/vmfs/devices/disks/Device" PartitionNumber NewStartingSector NewEndingSector

In my example, the above command will look like this:

root@swzesx01.wilks.lab > partedUtil resize "/vmfs/devices/disks/mpx.vmhba0:C0:T0:L0" 3 15472640 104857566

Ok, after running the above, we need to do some cleaning up. Firstly, it’s time to fix GPT table for the drive:

root@swzesx01.wilks.lab > partedUtil fixGpt "/vmfs/devices/disks/mpx.vmhba0:C0:T0:L0

Secondly, we should refresh the VMFS volume information within the OS:

root@swzesx01.wilks.lab > vmkfstools -V

Having that done, we can finally move onto expanding the datastore. The command needed here is as follows:

root@swzesx01.wilks.lab > vmkfstools --growfs "/vmfs/devices/disks/Device:partition" "/vmfs/devices/disks/Device:partition"

In my example the Device:partition bit is: mpx.vmhba1:C0:T0:L0:3 (we’ve got that from the first command in this tutorial)

root@swzesx01.wilks.lab > vmkfstools --growfs "/vmfs/devices/disks/mpx.vmhba1:C0:T0:L0:3" "/vmfs/devices/disks/mpx.vmhba1:C0:T0:L0:3"

Now we can log back into the ESXi web GUI or vCenter and confirm if the datastore has been in fact expanded.