AI Adsense

Monday, September 19, 2016

ESXi 6 - The Primary GPT table states that the backup GPT is located beyond the end of the disk

I was attempting to reinstall ESXi 6.0 on a server that had a previous datastore on a RAID 5 array.  The array was missing a disk so I destroyed and recreated the array minus the missing disk and decided to just do without the storage of the one disk.

When I attempted to add the array into my fresh ESXi 6 load I got this error:

Call "HostDatastoreSystem.QueryVmfsDatastoreCreateOptions" for object "ha-datastoresystem" on ESXi "xxx.xx.xxx.xxx" failed

Not knowing how to fix this I did some research and found out a quick and easy repair.

1. Enable SSH on the VMware host.
2. Connect and run "ls -lha /vmfs/devices/disks" and this will list your disks with their disk ID.
3. Run the following command on the disk "partedUtil getptbl /vmfs/devices/disks/naa.5000c501234597a333"

This will return the following output if you have chosen the correct disk:

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.5000c501234597a333) diskSize (286748000) AlternateLBA (570310655) LastUsableLBA (570310622)
Warning: The available space to /dev/disks/naa.5000c501234597a333 appears to have shrunk. This may happen if the disk size has reduced. The space has been reduced by (283562656 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 (286748000) AlternateLBA (570310655) LastUsableLBA (570310622) NewLastUsableLBA (286747966)
Error: Can’t have a partition outside the disk!
Unable to read partition table for device /vmfs/devices/disks/naa.5000c501234597a333

Apparently deleting the RAID array didn't fully erase all of the previous partition information.  Now it needs to be cleared manually.

4. Run the following to clear it:  "partedUtil setptbl /vmfs/devices/disks/naa.5000c501234597a333"

That's all there is to it.  By creating a msdos partition on the disk it will clear the previous error and allow esxi to create a datastore there with no errors.

Good luck!


















This is ve

No comments: