Cannot Erase ESXi Disk Partitions – Cannot change the host configuration

Last week,I tried to re-provision one of the existing ESXi hosts for building a new VSAN host for the VSAN cluster.  I have added the ESXi host to the VSAN cluster. When I try to create the disk group, I don’t find one of the disks showing up in the VSAN disk group creation wizard.

This will be a common problem in VSAN. Disks won’t be visible to be added as part of VSAN if there are existing partitions present on the disk. We can identify whether the disk has existing partitions or not by using the command “vdq-q” command in ESXi. It will show whether the disk is eligible or ineligible to be used by VSAN and also shows the reason why it is not eligible to use by VSAN.

If existing partitions are present in the disk, we can erase the partitions from the vCenter or ESXi UI using the “Erase Partitions” options.

Erase Partitions options work most of the time but this time, When I try to erase the disk partitions using the “Erase partitions” options. It didn’t work. It throws an error ” Cannot Change the host configuration”.

Not much information about the issue or error. Tried multiple times, and got the same error. Even tried to reboot the server and re-tried. Nothing worked.

Decided to troubleshoot this issue from the ESXi shell to get more information about this issue. I have used the command “PartedUtil delete” to delete the partition on the problematic disk. It throws the below error.

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.55cde0c5002339cec36) diskSize (286748000) AlternateLBA (570310655) LastUsableLBA (570310622)
Warning: The available space to /dev/disks/naa.5000c50023397a33 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.55cde0c5002339cec36

Fix –  Can’t have a partition outside the disk

It looks like that after deleting the RAID array not all VMFS partition table information was deleted too, so we had to clear it manually.
To do this I have manually created a normal msdos partition on the affected disks with the below  command:

partedUtil setptbl /vmfs/devices/disks/naa.55cd2e41241cec36 msdos

After setting a new partition, I was able to erase the disk partition using the “Erase partition” options and re-used the disk for the VSAN cluster.

I spend a lot of time troubleshooting this issue and re-using the disk for VSAN. I hope this article will be useful to you and will save a lot of time to troubleshoot this issue quicker if you have come across it. Thanks for Reading!!. Be social and share it with social media, if you feel worth sharing it.