Categories
VMware

Rename VMware Virtual machines on ESX

Ever wanted to rename a virtual machine and found out that the “Rename” option merely renames the “friendly name” in VirtualCenter? You could clone the VM to a new one with the proper name, but that requires a lot of downtime usually.
There is a quicker way:

  1. Shut down the VM
  2. Choose “Remove from inventory”
  3. Log into the ESX console and cd to the place where your VM is
  4. Rename the directory
  5. Rename all the files in the directory
  6. Change the names in the vmdk, vmsd, vmx, and vmxf files
  7. Browse the datastore and add the new vmx to the inventory

Or:

cd /vmfs/volumes/vmfs-data6
mv OldVM NewVM
cd NewVM
rename OldVM NewVM *
perl -pi -e 's/OldVM/NewVM/g' NewVM.vm*

One reply on “Rename VMware Virtual machines on ESX”

In VMware Vshere 4 things are more easy. You can rename from Vcenter, this renames only the display name. After that you should migrate the storage to another datastore. This will cause the new VM files to be created with the new name.
You need to have enough space available to shuffle a VM around, but it is much easier and is definitely less error prone.

Leave a Reply

Your email address will not be published. Required fields are marked *