Hi all. I have a vm that I scp'd while it was down to another VMware server. Problem is, how do I change the directory name to reflect the new name I want? When I change the name of the directory manually, the vmx file still has all the references to the original directory. Is there a way to do this automatically?
Example:
/volumename/server_name
I want to change it to /volumename/newserver_name
Thanks!
Hello,
There is a VM copy command floating around the forums that will do this for you. The only way to really do it, is to edit the files by hand or via a script to change the names appropriately within the configuration and metadata files.
Best regards,
Edward L. Haletky
VMware Communities User Moderator
====
Author of the book 'VMWare ESX Server in the Enterprise: Planning and Securing Virtualization Servers', Copyright 2008 Pearson Education.
CIO Virtualization Blog: http://www.cio.com/blog/index/topic/168354
As well as the Virtualization Wiki at http://www.astroarch.com/wiki/index.php/Virtualization
Try this thread:
http://communities.vmware.com/message/822788;jsessionid=F44C51342768E9B02B25A12A26A4571D
I found that creating a new vm with the name, and pulling in the disk from the old VM works.
Note, to crawl through things on the command line to perform a rename you can use the following:
find ./ -type f -exec sed -i 's/vmname/newvmname/' {} \;
I have used this command often in Linux, (great for fixing oracle hostnames etc.) I honestly have never tried it on a VM, but the concept should work.
Renaming the directory on the shell with the standard unix commands isnt the preferred way and also messing around in the vmx is also not bullet proof.
Remove the VM from your inventory
Use the Datastore browser to rename the directory
If you would like to change the name of the vmdks too you have to use vmkfstools-i old-name.vmdk new-name.vmdk on the shell
Import the VM by right- clicking on the vmx file and choose your new name
Remove the old disk and add a new one which points to the existing vmdk
Most of the tasks can be scripted i think.
Note: Renaming a VM with VI Client in VC does only change the display name and not the directory in the Filesystem.
regards
Joerg
Another option is to Clone the VM to the new name.
This will make a copy, and change the directory and filenames for you.
Once completed, delete the source VM and you're done.
I think you can do this another way, rename the VM in the VI Client, then cold migrate it to a new datastore. This may also work with Storage VMotion rather than the cold migration.
Scott.
Here's an easy way to do it.
Rename the VM something totally different.
Migrate it to another Host.
Change the name to what you want it
Migrate it back to the original Host.
As long as you've never had a VM with that name/directory name on that Host, it will name it to the name of the VM.
Jase McCarty
Thanks all.
I ended up just copying the .vmdk and -flate vmdk files to a directory on the server and then created a new vm with no hard disk, copied the files into the shell directory and then added the hard disk. This seems to work pretty good. The only reason I'm not using templates is bc the VC server is not setup yet and I'm under the gun to get 5 or 6 vm's done.
Thanks all.
-JC