How to rename a VMDK file in ESX and ESXi

Ok, here’s another real world scenario worthy of a mention. Not really because it’s rocket science but more to get it into the search engines as a recent customer visit revealed they couldn’t find a step by step guide whilst trawling the web.

Here’s mine.

ESX 3.x and 4.x

  1. Ensure the virtual machine has been shut down gracefully and is powered off.
  2. Remove the hard disk from the virtual machine within the VMware Infrastructure client but DON’T delete the disk, just remove the entry.
  3. Using PuTTy, an iLO, RSA or something else with remote control access login to an ESX host that has access to to the data store where the virtual machine is located.
  4. Navigate to the virtual machine <DIR>.
  5. Use the ‘mv‘ command and rename the two VMDK files for example:
    1. mv win2k3-prn1.vmdk win2k3-print1.vmdk
    2. mv win2k3-prn1-flat.vmdk win2k3-print1-flat.vmdk
  6. Using VI (or a similar editor) open the win2k3-print1.vmdk file.
  7. You’ll notice a reference to the win2k3-prn1-flat.vmdk, this will need amending to reflect the new name.
  8. Save and close the file.
  9. Logout of the ESX host and return to your VMware Infrastructure Client.
  10. Add a hard disk to the virtual machine by browsing to the newly renamed file.

Well done, that was it.

Hey, what about ESXi?

The hidden service console will have to be used. WARNING, VMware will not support any activities undertaken using this console unless you have been directed to do so by them.

Review VMware’s KB Article for full and further information about this feature: KB 1003677.

  1. At the ESXi console press ALT + F1
  2. Type in the word ‘unsupported‘ and press ENTER, no text will be echoed when typing so don’t get it wrong.
  3. Provide the ‘root‘ password when prompted.
  4. Complete the tasks as directed above.
  5. Once complete, type in ‘clear‘ and press ENTER to hide all recent text display.
  6. Type in ‘exit‘ and press ENTER to logout.
  7. Press ALT + F2 to return the familiar ESXi console.

That’s all for now.