Tuesday, 29 March 2016

Resolving Error "Failed to clear disk on...." when clearing a partition table

I'm starting a new project and I needed to spin up a single nested ESXi host and deploy a VCSA to manage and integrate with NSX.  I used to run a VSAN cluster a while back to get more familiar with the product but disabled it when I was finished.  When starting this new project I decided to utilise the SSD in my host as a datastore for my new nested ESXi host to improve performance.  I upgrade the host to ESXi 6.0 U2 to utilise the new HTML5 host Web Interface and started to create the new SSD Datastore.  I first had to clear the existing partition table which is a lot easier in the web client now rather than having to use the CLI but I encountered the "Failed to clear disk Local HP Disk" error:



I then tried to do this via partedUtil but encountered a "Read-only file system during write on" error:


I verified the device wasn't being used for any existing datastore's, DRM's or diagnostic logs:


I remembered that this device was previously used for VSAN so checked that it still wasn't a member of the cluster, which it wasn't, but the devices were still associated with the disk group somehow:


Problem was resolved by using the "esxcli vsan storage remove -u <VSAN UUID>" to disassociate the device from the VSAN Cluster:


Once this was completed the devices were no longer in use and I could clear the partitions and create a local datastore.