Rename a VMDK file in VMware’s ESX server.

A vmdk file is a VMware Virtual Disk file. This is the file used by VMware ESX server that represents a hard drive on a virtual machine.

Renaming a vmdk file is not as simple as opening the datastore viewer, right click and rename. No, that would be too easy. To do it, you have to break out the SSH session. Ready for command line??

How to do it:
Open a putty session to your ESX server, type in the username and password, and get ready to enter the following commands:

cd /vmfs/volumes/STORAGENAME/VMNAME [Enter]
ls [Enter] (Optional – to see what your working on.)
mv OLDNAME.vmdk NEWNAME.vmdk [Enter]
mv OLDNAME-flat.vmdk NEWNAME-flat.vmdk [Enter]

This basically moves the vmdk and in the process renames it.
This next part is what makes the whole thing work, so pay close attention.

type vi NEWNAME.vmdk
This brings up a “New Screen”. Hit the down arrow till you get to the line that starts with RW, then hit the right arrow key till you get to OLDNAME.vmdk. Youll want to change OLDNAME.vmdk to NEWNAME.vmdk. Position your curser on the 1st Quote and hit “A”. Edit the OLDNAME like normal, then hit Esc.

Once finnished type :wq [Enter]

Thats it!

You can type ls if you want to check to make sure the change was successfull, but is not necessary.

Another Method:
In a SSH session type the following commands:
cd /vmfs/volumes/STORAGENAME/VMNAME [Enter]
vmkfstools -E ./OLDNAME.vmdk ./NEWNAME.vmdk [Enter]

Be Sociable, Share!

Comments are closed.