How To: Changing The Name of a Virtual Machine While It Is Running

Did you know?

That if you change the name of a virtual machine while is powered on; the files that consist for that VM will not be changed.  This would mean that vCenter would display a different name that would be found in the file system level. To resolve this while the VM is running it is recommended that you:

  1. Change the name.
  2. Use VMotion to move the machine to a new datastore (This will rename the files that are copied).
  3. VMotion back.
  4. Done!

This will avoid confusion and having to shut down the VM for any scheduled downtime. On the flipside, you can do it the proper way:

  1. Make sure there is no snapshots etc.
  2. Shutdown the virtual machine.
  3. If you are using VirtualCenter, remove the virtual machine from the inventory but do not delete the files from disk.
  4. Connect to the ESX Server host on which the virtual machine resides over SSH.
  5. Unregister the virtual machine using command: vmware-cmd -s unregister <path to config file>
  6. Where <path to config file> is the path to the configuration file as determined by ‘vmware-cmd –l’ . ‘/vmfs/volumes/storage1/vm1/vm1.vmx’
  7. Rename the folder, .vmx file, and .vmdk (+ flat) file to match the new name.
  8. Edit the vmx file to reflect the name of the new descriptor file.
  9. Locate the scsi0:0.fileName line.
  10. Save the file and exit
  11. Edit the .vmdk file to reflect the name of the new flat file.
  12. Locate the Extent description section of the .vmdk file.
  13. Register the virtual machine.
  14. Add the virtual machine back into VirtualCenter inventory using the Virtual Infrastructure Client by browsing the data store, finding the .vmx file, right-clicking and adding it to inventory.

For more details.