Fix error when adding datastore in VMware ESXi
When adding a datastore to VMware ESX/ESXi with the Add Storage wizard, the following error appears.
An error occurred during host configuration. Call “HostDatastoreSystem.QueryVmfsDatastoreCreateOptions” for object “ha-datastoresystem” on ESXi “xxx.xxx.xxx.xx″ failed. An internal error occurred in the vsphere client.
Possible causes are:
- The LUN is larger than 2TB - 512 bytes (vSphere 4).
- The LUN was previously used for RDM (Raw Device Mapping).
- The LUN has a GPT partition that cannot be removed.
Most cases involve reusing a LUN (items 2–3) with a partition type of bsd, dvh, gpt, loop, mac, pc98, or sun, which prevents datastore creation. A disk with an msdos partition type or no partition can be used. To resolve this, delete the partition table on the affected LUN. First list all device names so that you can identify the problematic device.
ls /vmfs/devices/disks/
WD2DWCAT25376266 vml.0100000000202020202057442d574341543235333736323636574443205744
WD2DWCAT25376266:1 vml.0100000000202020202057442d574341543235333736323636574443205744:1
WD2DWCAT25376266:2 vml.0100000000202020202057442d574341543235333736323636574443205744:2
WD2DWCAT25376266:5 vml.0100000000202020202057442d574341543235333736323636574443205744:5
WD2DWCAT25376475 vml.0100000000202020202057442d574341543235333736343735574443205744
WD2DWCAT25376475:1 vml.0100000000202020202057442d574341543235333736343735574443205744:1
WD2DWCAT25376475:2 vml.0100000000202020202057442d574341543235333736343735574443205744:2
WD2DWCAT25376475:3 vml.0100000000202020202057442d574341543235333736343735574443205744:3
WD2DWCAT25376475:5 vml.0100000000202020202057442d574341543235333736343735574443205744:5
WD2DWCAT25376475:6 vml.0100000000202020202057442d574341543235333736343735574443205744:6
WD2DWCAT25376475:7 vml.0100000000202020202057442d574341543235333736343735574443205744:7
WD2DWCAT25376475:8 vml.0100000000202020202057442d574341543235333736343735574443205744:8
Use fdisk to identify the affected device with this command.
fdisk -l "/vmfs/devices/disks/DISK_NAME"
DISK_NAME is the disk device name. For example:
~ # fdisk -l "/vmfs/devices/disks/WDCCAT25376266"
Disk /dev/disks/WDCCAT25376266: 160.0 GB, 160000000000 bytes
255 heads, 63 sectors/track, 19452 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/disks/WDCCAT25376266p1 * 1 18237 146483200 fd Linux raid autodetect
/dev/disks/WDCCAT25376266p2 18237 19453 9763841 5 Extended
/dev/disks/WDCCAT25376266p5 18237 19453 9763840 fd Linux raid autodetect
Found valid GPT with protective MBR; using GPT
fdisk: Sorry, can't handle GPT partitions, use partedUtil
The example shows that this device contains GPT partitions, so VMware cannot use it as a datastore. Delete its partition table with the following command so that VMware sees it as an empty disk.
~ # dd if=/dev/zero of="/vmfs/devices/disks/DISK_NAME" bs=512 count=34 conv=notrunc
For example:
~ # dd if=/dev/zero of="/vmfs/devices/disks/WDCCAT25376266" bs=512 count=34 conv=notrunc
34+0 records in
34+0 records out
GPT also stores a backup partition table in the last 34 sectors of the disk. Delete that too using a similar command, first calculating the starting position of the last 34 sectors as follows: (SizeInBytes / 512) - 34 = SeekOffset Use the calculated starting position of the last 34 sectors as SeekOffset in the command below.
# dd if=/dev/zero of="/vmfs/devices/disks/DISK_NAME" bs=512 count=34 seek=SeekOffset conv=notrunc
The disk in the example above is 8225280 bytes, so calculate SeekOffset as follows: (8225280 / 512) - 34 = 16031 Command to delete the GPT backup partition table
~ # dd if=/dev/zero of="/vmfs/devices/disks/WDCCAT25376266" bs=512 count=34 seek=16031 conv=notrunc