Loading

×Sorry to interrupt
CSS Error

Refresh

Cookie Preference Center

General Information on cookies

When you visit our website, we use cookies to ensure that we give you the best experience. This information does not usually directly identify you, but it can give you a more personalized web experience. Because we respect your right to privacy, you can choose not to allow some types of cookies by clicking on the different category headings to find out more and change your settings. However, blocking some types of cookies may impact your experience on the site and the services we are able to offer. Further information can be found in our

Cookie Policy.

Strictly Necessary

Strictly Necessary

Always Active

Strictly Necessary

Strictly necessary cookies are always enabled since they are essential for our website to function. They enable core functionality such as security, network management, and website accessibility. You can set your browser to block or alert you about these cookies, but this may affect how the website functions. For more information please visit www.aboutcookies.org or www.allaboutcookies.org.

Cookie Details‎

Performance

Performance

Performance

Performance cookies are used to analyze the user experience to improve our website by collecting and reporting information on how you use it. They allow us to know which pages are the most and least popular, see how visitors move around the site, optimize our website and make it easier to navigate.

Cookie Details‎

Please confirm your settings by refreshing the page.

Functional

Functional

Functional

Functional cookies help us keep track of your past browsing choices so we can improve usability and customize your experience. These cookies enable the website to remember your preferred settings, language preferences, location and other customizable elements such as font or text size. If you do not allow these cookies, then some or all of these services may not function properly.

Cookie Details‎

Advertising

Advertising

Advertising

Advertising cookies are used to send you relevant advertising and promotional information. They may be set through our site by third parties to build a profile of your interests and show you relevant advertisements on other sites. These cookies do not directly store personal information, but their function is based on uniquely identifying your browser and internet device.

Cookie Details‎

Advertising Cookies

Consent Leg.Interest

Select All Vendors

Select All Vendors

Select All Hosts

Select All

Clear Filters

Information storage and access

Apply

Confirm My Choices Reject All Allow All

My Subscriptions

Loading

Knowledge Base

Rebuilding the virtual machine's .vmx file from vmware.log (1023880)

Last Updated: 10/29/2020Categories: How toTotal Views: 123642Language:
Chinese (Simplified)JapaneseEnglish

5 like this article

Subscribe to get an email
newsletter with new updates

5 people found this helpful Please provide article feedback:

Purpose

This article provides steps to rebuilds the .vmx file from the vmware.log file using a shell script.

You may want to rebuild the .vmx file of a virtual machine and recover its contents if the .vmx is missing or has lost its configuration.

Resolution

To rebuild the virtual machine's .vmx file using a shell script which parses the information from the vmware.log file:

Notes:

VMware does not guarantee that this script will recover every .vmx file. This is only an option to try if the operation becomes necessary. For example, if the virtual machine configuration is changed after the last power on, then that information is not logged in the vmware.log and the .vmx file may not be accurate.

Ensure to take a backup of the .vmx file before proceeding.

Ensure that you run the commands or the script from the virtual machine working directory. To determine the working directory, right-click the virtual machine and click Edit Settings, then click Options > Virtual Machine Working Location.

SSH to an ESXi host

Change directory into the virtual machine's working directory

Run this command to create a new file using a text editor and grant the execute permissions by running this command:

touch vmxrebuild.sh && chmod +x vmxrebuild.sh

Edit the vmxrebuild.sh file using vi editor and insert below script to the file:

Run vi vmxrebuild.sh

Press insert, copy and paste the below script (according to ESXi host version) and press ESC, type :wq! to save/write and quit the editor mode.

ESXi 6.5/6.7/7.0

VMXFILENAME=$(sed -n 's/^.*Config file: .*\/\(.\+\)$/\1/p' vmware.log)
echo -e "#\041/usr/bin/vmware" > ${VMXFILENAME}
echo '.encoding = "UTF-8"' >> ${VMXFILENAME}
sed -n '/DICT --- CONFIGURATION/,/DICT ---/ s/^.*DICT \+\(.\+\) = \(.\+\)$/\1 = \2/p' vmware.log >> ${VMXFILENAME}

ESXi 5.0/5.1/5.5/6.0

VMXFILENAME=$(sed -n 's/^.*Config file: .*\/\(.\+\)$/\1/p' vmware.log)
echo -e "#\041/usr/bin/vmware" > ${VMXFILENAME}
echo '.encoding = "UTF-8"' >> ${VMXFILENAME}
sed -n '/DICT --- CONFIGURATION/,/DICT ---/ s/^.*DICT \+\(.\+\) = \(.\+\)$/\1 = "\2"/p' vmware.log >> ${VMXFILENAME}

For information on how to use a text editor, see Editing files on an ESX host using vi or nano (1020302).

If the uuid.location has changed due to operations, such as cloning or Storage vMotion, run this command to get the new UUID. Otherwise, skip this step 3 and skip step 4.

NEWUUID=$(sed -n "s/^.*UUID: Writing uuid.location value: '\(.\+\)'.*$/\1/p" vmware.log)

Note: Whenever possible, use the latest vmware.log file.

Run this command to replace the old UUID in the .vmx file with the new one:

if [ "${NEWUUID}" ] then sed -i "s/uuid.location = .*$/uuid.location = \"${NEWUUID}\"/" ${VMXFILENAME} fi

Run the script using this command:

./vmxrebuild.sh

Note: the script is lightweight and will completely almost immediately. Once the script completes, the prompt will return to the next line. There will be no message that indicates completion.

Confirm a new .vmx has been created in the VM's working directory.

For more information, see Recovery of a lost or deleted virtual machine configuration file .vmx on an ESXi/ESX host (1002294).

Related Information

To be alerted when this document is updated, click the Subscribe to Article link in the Actions box in the Actions box.
Recovery of a lost or deleted virtual machine .vmx configuration file on an ESXi/ESX host
Editing files on an ESX host using vi or nano
vmware.log から仮想マシンの .vmx ファイルを再構築する
从 vmware.log 重新构建虚拟机的 .vmx 文件

Detectable by VMware SkylineTM

Actions

Copy

link to clipboard
copied!

Print

Language:
Chinese (Simplified)JapaneseEnglish

Attachments

Additional Resources

KB
•
End Of General Availability of the Free vSphere Hypervisor (ESXi 7.x and 8.x) (2107518)

KB
•
Download and Install VMware Fusion (2014097)

Results 1-2 of 2

Ask The Community

Get answers quickly from VMware experts in the community

Post Subject

CONTINUE IN COMMUNITIES

Related Products:

VMware vSphere ESXi

Related Versions:

VMware vSphere ESXi 7.0.0

VMware vSphere ESXi 6.7

VMware vSphere ESXi 6.5

VMware vSphere ESXi 6.0

VMware vSphere ESXi 5.5

VMware vSphere ESXi 5.1

VMware vSphere ESXi 5.0

Take Our Survey

Support Assistant