The vmx file is the configuration file of  a particular VM.If you need to edit, you have to make sure of the procedure and a backup of the original file is always a good idea.

Note the following important characteristics of this file:

  • The .vmx file is typically located in the directory where you created the virtual machine.
    • In Windows XP / Server 2003, the default location for the file is:
      C:\Documents and Settings\<your_user_name>My Documents\Virtual Machines\<virtual_machine_name>.vmx.
    • In Windows Vista / Windows 7 / Windows Server 2008, the default location for the file is
      C:\Users\<your_user_name>\My Documents\Virtual Machines\<virtual_machine_name>.vmx.
    • In Linux, vmware-cmd -l lists the full path to all registered .vmx files.
  • The virtual machine actively writes to its .vmx file. Never edit this file while its virtual machine is running.
  • Changes to the file are usually version specific. If you upgrade, the workaround you implemented may no longer work.

Before you edit the .vmx file:

  • Always power off the virtual machine.
  • Make sure you are logged on as a user with the correct permission level to edit the file.
  • Make a backup copy of the .vmx file. If your edits break the virtual machine, you can roll back to the original version of the file.
Also, make a backup copy of the edited file. If future administrative changes to the virtual machine overwrite your edited version, you can cut and paste the specific section you want from the backup copy into the current file. Do not replace an entire .vmx file with an older backup.
Important for ESX with VirtualCenter: Any manual additions to the .vmx file from ESX 3.x are overwritten by the entries stored in the VirtualCenter database.If you need to edit a virtual machine’s .vmx  file, first remove it from VirtualCenter’s inventory (right-click it and choose Removefrom Inventory). After you edit it, register the virtual machine again from the ESX command line using:

vmware-cmd -s register /vmfs/volumes/<datastore>/<virtual machine directory>/<virtual machine name>.vmx
The <datastore> represents the datastore name, the <virtual machine directory> represents the directory containing the virtual machine files, and <virtual machine name> represents the name of the virtual machine files.  The following is an example:vmware-cmd -s register /vmfs/volumes/Storage1/vm1/vm1.vmx

A return code =1 signals success.

Using the VIM command would look like:

#vim-cmd solo/registervm /vmfs/vol/datastore/dir/vm.vmx

Using the directory in the above example would look like:

#vim-cmd solo/registerv /vmfs/volumes/Storage1/vm1/vm1.vmx

Advertisements