Encountered an issue I haven’t seen at work, caused by re-using disks in my homelab. The disks were previously in use on a Windows Server, and after transferring the disks to my main homelab server I couldn’t create a VMFS partition from the vSphere GUI.
I received the error “Call HostDatastoreSystem.QueryVmfsDatastoreCreateOptions for object ha-datastoresystem on ESXi xxx.xxx.xxx.xx failed” and couldn’t format the disk.
The solution it to overwrite any partition data on the disk with a ms-dos partition. This will allow VMware to create a VMFS partition without issues. Remember to be careful and verify you are modifying the correct disk as this procedure is destructive!
You can verify the issue with the command “partedutil “getpbl” /vmfs/devices/disks/naa.xxxxx
[root@nbyte-esx:~] partedUtil "getptbl" /vmfs/devices/disks/naa.644a842019688exxxxxxxxe019be4fd
Error: Input/output error during read on /dev/disks/naa.644a842019688exxxxxxxxe019be4fd
Error: The primary GPT table states that the backup GPT is located beyond the end of disk. This may happen if the disk has shrunk or partition table is corrupted. Fix, by writing backup table at the end? This will also fix the last usable sector appropriately as per the new reduced size. diskPath (/dev/disks/naa.644a842019688exxxxxxxxe019be4fd) diskSize (29995565056) AlternateLBA (48742793215) LastUsableLBA (48742793182)
Warning: The available space to /dev/disks/naa.644a842019688exxxxxxxxe019be4fd appears to have shrunk. This may happen if the disk size has reduced. The space has been reduced by (18747228160 blocks). You can fix the GPT to correct the available space or continue with the current settings ? This will also move the backup table at the end if it is not at the end already. diskSize (29995565056) AlternateLBA (48742793215) LastUsableLBA (48742793182) NewLastUsableLBA (29995565022)
Error: Can't have a partition outside the disk!
Unable to read partition table for device /vmfs/devices/disks/naa.644a842019688exxxxxxxxe019be4fd
Next create the msdos partition with partedutil mklabel command and verify with partedutil “getptbl”.
[root@nbyte-esx:~] partedUtil mklabel /vmfs/devices/disks/naa.644a842019688exxxxxxxxe019be4fd msdos
[root@nbyte-esx:~] partedUtil "getptbl" /vmfs/devices/disks/naa.644a842019688exxxxxxxxe019be4fd
msdos
1867137 255 63 29995565056
After this you can create a new VMFS datastore with the vSphere GUI like expected. The output will be along these lines once you have a vmfs datastore.
[root@nbyte-esx:~] partedUtil "getptbl" /vmfs/devices/disks/naa.644a842019688exxxxxxxxe019be4fd
gpt
1867137 255 63 29995565056
1 2048 29995555904 AA31E02A400F11DB9590000C2911D1B8 vmfs 0
VMware official KB details: Formatting LUN as VMFS 5 fails with the error: Can’t have a partition outside the disk! (2082806) (vmware.com)