In the VCSA Web Client, there is a function called Erase partitions under Storage Devices, that allows you to erase and remove all partitions on the local hard disk(s). However, sometimes when you try to erase partitions, you are presented with the error “Cannot change the host configuration“, and the partitions are not removed. One of the options was to boot up the server using gParted utility and erase partitions. However, this can be done using partedUtil utility on the ESXi host.
Connect to ESXi host using SSH and list your local disks
# esxcli storage core device list | grep Local
Now we can start to remove partition using partedUtil utility
# partedUtil setptbl /vmfs/devices/disks/naa.500XXXXXXXXXXXXX:1 msdos
You should receive the following output:
msdos 0 0 0 0
Wait for a couple of minutes and then remove the second partition using the same command
# partedUtil setptbl /vmfs/devices/disks/naa.500XXXXXXXXXXXXX:2 msdos
Wait again for a couple of minutes and then clean the entire disk
# partedUtil setptbl /vmfs/devices/disks/naa.500XXXXXXXXXXXXX msdos
Should you fail to wait you will be presented with the following error: “Error: Read-only file system during write on /dev/disks/naa.500xxxxxxx – WriteNewPtable : Unable to commit to disk“. Solution: Wait and try again.