Unable to expand a datastore on ESXi host.
vSphere ESX
The partition table on the underlying storage device is not reflecting the correct partition table and ending Usable Sectors by the extension of new space to the last partition.
Prior to completing the following steps, migrate VMs to a different host and back up the ESX configuration https://knowledge.broadcom.com/external/article/313510
Step 1. Identify the disk and partition to work with:
Run the ls -alh /vmfs/devices/disks command to list the possible targets for certain storage operations.
esx# ls -alh /vmfs/devices/disks
Output will be similar to:
Output will be similar to:
lrwxrwxrwx 1 root root 19 Jul 27 16:40 vml.##################a11 -> mpx.vmhba2:C0:T0:L11
lrwxrwxrwx 1 root root 21 Jul 27 16:40 vml.##################a11:8 -> mpx.vmhba2:C0:T0:L11:8
lrwxrwxrwx 1 root root 36 Jul 27 16:40 vml.02000##################011 -> naa.##################011
lrwxrwxrwx 1 root root 38 Jul 27 16:40 vml.02000##################011:8 -> naa.##################011:8
Note: Partition # 8 is used as an example. Use the correct VMFS partition for your disk. Use the correct start sector for your partition and correct end sector of your disk.
Step 2: Query and Backup the current partition table. Save this output.
esx# partedUtil getptbl /vmfs/devices/disks/naa.##################011
Step 3. Get the current Usable Sectors of the disk. Save this output.
esx# partedUtil getUsableSectors /vmfs/devices/disks/naa.##################011
Step 4. Follow hardware vendor documentation to run Smart Array utility to expand the logical drive.
Step 5. Query the partition table. It will error out and prompt for fix.
esx# partedUtil getptbl /vmfs/devices/disks/naa.##################011
Example output:
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:T1:L0 appears to be used, you can fix the GPT to use all of the space (an extra 4194304 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.
Step 6. Query the Usable Sectors. It will error out and prompt for fix.
esx# partedUtil getUsableSectors /vmfs/devices/disks/naa.##################011
Example output:
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:T1:L0 appears to be used, you can fix the GPT to use all of the space (an extra 4194304 blocks) or continue with the current setting? This will also remove the backup table at the end if it is not at the end already.
Step 7. Run fixGPT to fix the partition table and Usable Sectors.
esx# partedUtil fixGpt /vmfs/devices/disks/naa.##################011
Example output:
FixGpt tries to fix any problems detected in GPT table.
Please ensure that you don't run this on any RDM (Raw Device Mapping) disk.
Are you sure you want to continue (Y/N): Y
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)?
Fix/Ignore/Cancel? Fix
Step 8. Query the partition table.
esx# partedUtil getptbl /vmfs/devices/disks/naa.##################011
or
esx# partedUtil getptbl /vmfs/devices/disks/CO:TO:L11
Example output:
8 268437504 10542514142 #### vmfs 0
Step 9. Query the Usable Sectors. (note the new ending sector) i.e. 10542514142
esx# partedUtil getUsableSectors /vmfs/devices/disks/naa.###011
Example output:
34 10542514142
Step 10: Resize the "disk" partition # start sector end sector
esx# partedUtil resize "/vmfs/devices/disks/naa.###011" 8 268437504 10542514142
Step 11. Run vmkfstools.
esx# vmkfstools -V
Step 12: Check UI and refresh, Storage, Datastore, Extent, Blue naa link.
The Disk partition will be extended into the adjacent new space in the next step.
The VMFS datastore still shows the original size and will be updated in Step 13.
Step 13: Grow the file system into the adjacent new space.
esx# vmkfstools --growfs "/vmfs/devices/disks/naa.011:8" "/vmfs/devices/disks/naa.###011:8"
Step 14: Run vmkfstools.
esx# vmkfstools -V
Step 15. Check UI and refresh Datastore to see the size increase.
"Warning: Be very careful to not overlap the any Primary and Logical partitions. This could result in data loss." VMware does not offer data recovery services.
This article provides contact information for data recovery service providers and Identify the disk and partition to work with.