Howto: Rename a VM
There are a couple of ways to rename a Virtual Machine, but there are two in my opinion that stand out:
- Shutdown the VM
- Rename the VM in VirtualCenter
- Migrate the VM and move it to another Datastore
- done!
And from the service console:
- vmware-cmd -s unregister /vmfs/volumes/datastore/vm/vmold.vmx
- mv /vmfs/volumes/datastore/vm-old /vmfs/volumes/datastore/vm-new
- cd /vmfs/volumes/datastore/vm-new
- vmkfstools -E vm-old.vmdk vm-new.vmdk
- find . -name ‘*.vmx*’ -print -exec sed -e ‘s/vm-old/vm-new/g’ {} ;
- mv vm-old.vmx vm-new.vmx
for every file that hasn’t been renamed (.vmsd etc.)- vmware-cmd -s register /vmfs/volumes/datastore/vm-new/vm-new.vmx
- done!