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:
- Shut down the VM
- Choose “Remove from inventory”
- Log into the ESX console and cd to the place where your VM is
- Rename the directory
- Rename all the files in the directory
- Change the names in the vmdk, vmsd, vmx, and vmxf files
- 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*
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.