Fixing "HostDatastoreSystem.QueryVmfsDatastoreCreateOptions" Issue

Having recently made a right old mess of my home lab, I set about building it from scratch over the weekend. Having installed some nice, fresh builds of ESXi 5.0 I started adding in my SATA disks and began to create VMFS datastores on the hosts.

The first one worked ok. The second one didn't for some reason. I got an error part way through the “Add Storage” wizard. The error stack wasn't too helpful:

Call “HostDatastoreSystem.QueryVmfsDatastoreCreateOptions” for object “datastoreSystem-9” on vCenter Server “svr-vcenter.vspecialist.co.uk” failed.

I didn't think that there was a problem with the disk as I had been using it recently. On closing the error window though I noticed that underneath, in the properties area for the drive, the available space was showing nothing free and the partition format didn't seem to be recognised either.

The simple explanation for why this was the case is that I had been using one of my lab servers to run Windows until recently and it still would have had partitions on from that. I'm fairly sure that there's a VMware KB on this already but the KB site doesn't seem to be working too well right at the moment so I thought I'd write up my solution anyway.

Now I could have taken the drive out and put it in another server to give it a “clean” but it's quick enough to do it in ESXi using the SSH shell (which I had enabled previously.

Once logged in as root on the ESXi host, executing fdisk -l confirmed what I thought about the contents of the disk.

“Cleaning” it was also easily achieved using fdisk. To start fdisk and set it to point at the disk in question meant running the following:

[text]fdisk /dev/disks/t10.ATA_____GB0750C4414_____________________________5QD4AQ8D____________[/text]

(The bit after /dev/disks is the unique name or ID of the disk in the server and can be seen in a couple of the screenshots above. It can also, mercifully, be entered / completed using command completion / the TAB key.)

Then it's simply a matter of deleting the existing partitions using the command “d” and picking the various partitions to delete until they're all gone.

FInally, the command “w” writes the changes to the disk and quits fdisk. Now, back to the vSphere Client…

After a quick rescan of storage devices, when trying to create a datastore on the disk there is now no error and the drive properties make a little more sense!