I ran into an issue where there was a datastore present in the datastore inventory view that was no longer in existance. Deleting this datastore was not an option as after right clicking the delete option was disabled. First things to check…do you have a virtual machine(s) with a disk(s) located on this datastore? In my case I did…
So just delete or remove the disk from the vm right?, easy fix, well, not so much. After trying to simply remove this disk from the VM in question I got a "Invalid Configuration for device 0" error. Basically, it's trying to delete or remove a disk residing on a datastore that no longer exists, thus it's having issues when trying to access the disk (since it's not real anymore). The way I got around this was to take note of a couple of items. The first being the datastore that contains the Virtual Machine Configuration (vmx) file (Found Under Options Tab) and the second being the SCSI address of the Virtual Disk that you are trying to remove.
Now, in order to remove this disk from the VM we will have right click the vm and remove it from inventory. Once this is done you will need to SSH into the host and navigate to the Virtual Machine configuration file location we noted earlier. Once in the correct location we need to edit the vmx file for that vm.vi NAME_OF_VM.vmx
Inside this file you should be able to find the three lines which define the disk that we cannot remove. They should be in a form similar to below, replacing scsi1:0 with the scsi address noted previously.
We need to comment out all of these lines by placing a '#' in front of them, then save the file. When complete the lines should look as follows…
Now, from within the VI client you can browse to the datastore containing the vmx file, right click and add to inventory. Or run the following from command line (just note, if you have vCenter running, use it. You don't want mismatches between the host and vCenter, it just gets mucky)vim-cmd solo/registervm /vmfs/volumes/datastore_name/VM_directory/VM_name.vmx
There, now we have removed the non-existant disk from the VM. If your datastore that you were trying to delete had no other vms with non-existant disks pointing to it and if it was really invalid, you will probably notice that it has now….disappeared! That's all! 🙂