Error Adding Storage to ESX Host

If you have spent any time configuring VMware ESX you would probably have encountered the dreaded “Hard Disk is Blank” error when trying to add storage to your host. This error is more likely to occur when you are reusing a hard disk or if you are writing over existing data.

The cause of the error according to VMware is the disk contains a non MBR or GPT partition, however while researching this I have found that to not always be true. There is nothing you can do from the GUI to resolve this issue so lets get down to the commands.

First of all you will need to enable SSH or get console access to your host you can read more about this here.

After you are on your host you can use the following command to list the disks on your system

ls -la "/vmfs/devices/disks/"

You will need to identify your disk by either the disk size, title or ID, you can get more info on disks by using the following command, remember to replace DISKNAME with the name of your drive

fdisk -l "/vmfs/devices/disks/DISKNAME"

Now we can use dd to erase the partition table from the drive, keep in mind that the GPT partition table is stored on the last 34 sectors of the drive so it is necessary to remove those also.

This command removes the first 34 sectors:

dd if=/dev/zero of="/vmfs/devices/disks/DISKNAME" bs=512 count=34 conv=notrunc

We need to do a little math to find the last 34 sectors of our disk, use the method below:

Size = Total Size of the disk in bytes
(Size / 512) – 34 = OFFSET
For Example: (1035993088 / 512) -34 = 2023390

Replace the word OFFSET with the value that you discovered from the math above and this will erase the last 34 sectors of the disk

dd if=/dev/zero of="/vmfs/devices/disks/DISKNAME" bs=512 count=34 seek=OFFSET conv=notrunc

Now that this is done you should be able to mount the disk using the Vsphere client GUI like you would normally

The hardest part of this process is identifying the right drive in a fully loaded system for more help with this there are some great articles on VMware knowledge base here