Before I start on this it should be noted the features in question here are shown as experimental in the vCenter GUI, so bugs should be expected, however this particular feature has been included as experimental since at least 3.5 and I have seen this issue occur an every version between 3.5 and 5.0. So far I have not had the chance to test it on 5.1.

The issue occurs if when you are deploying a new VM from a template, at the end of the deployment wizard there is a tick box to “Edit virtual hardware (Experimental)”.  If this box is selected then when he deployment wizard is closed, the VM settings windows for the VM to be deployed will be opened allowing the hardware to be changed prior to deployment.

Using this method I have successfully been able to change most hardware settings without any problems, however if you modify the size of any virtual disks being copied from the template disks it will cause the newly created VM to use the templates virtual disk as the C:\ drive (or any other drives modified in the same way.)

Luckily in most cases I have seen this happen it has been caught strait away before any further modification was done to the deployed VM and the VM could just be deleted and the template would work as normal.

If this is not caught when deploying the VM then the newly created VM will continue writing all changes to the templates virtual disk and if further deployments are tried from the template there will be an error stating the VMDK file is locked and the deployment has failed. If the issue has go to this stage you can locate the VM locking the template VMDK with he following PowerShell in PowerCLI.

Connect-VIServer -Server "FQDN for vCenter server"

Get-VM | Get-HardDisk | Where {$_.FileName -Like "*Part of filename of VMDK on problem template string, including the asterisks*"}

If you run this command it will list information about the problem disk  and the “Parent” object will tell you the machine name of the VM with the disk mounted.  You can then use that information to clean up the problems.  In every case I have worked on has meant vMotioning the disk to sit in the correct folder for the VM and then deleting and creating a new template.

Any questions or better Ideas for resolving this post in the comments.