Today I was playing in my home lab environment. After installing a new vSphere 4.1 host, I went on to add an iSCSI target as a datastore, however it failed with an error
Call "HostDatastoreSystem.CreateVmfsDatastore" for object "ha-datastoresystem" on ESXi "host??.??????.com" failed.
I failed to understand why???
Just a day before I had used the same LUN to create a VMFS5 datastore on a vSphere 5.0 host. So I decided to investigate further. Logged in to the vSphere host via the troubleshooting shell and went through the /var/log/messages.
I found the following error:
Hostd: Error : Unsupported partition table (gpt) on disk. Only msdos supported
Then I realized that when I created a VMFS5 partition on the same LUN, it also updated the disk label to “gpt”, and whereas vSphere 5.0 can understand both “gpt” & “msdos”, vSphere 4.1 is unable to handle the “gpt” labels .
The fix was to remove the gpt label! So I quickly assigned the said iSCSI LUN to my Linux box, and removed it using the parted utility.
root@linux-vm:~# parted /dev/sdd GNU Parted 2.2 Using /dev/sdd Welcome to GNU Parted! Type 'help' to view a list of commands. (parted) mklabel msdos Warning: The existing disk label on /dev/sdd will be destroyed and all data on this disk will be lost. Do you want to continue? Yes/No? yes (parted) quit Information: You may need to update /etc/fstab. root@linux-vm:~#
After removing the “gpt” label, on retrying to create a VMFS3 filesystem on the said LUN, everything worked smoothly.
Moral of the Story: If you are planning to use/format a LUN with VMFS3 using vSphere 4.x and if you had used the LUN earlier to create a VMFS5 filesystem then you will first need remove the “gpt” label from your LUN.