Skip to main content

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

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

Also version 6.5 is covered below

Purpose

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.

This article provides a shell script that rebuilds the .vmx file from the vmware.log file.



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.Run this command to create a new file using a text editor and give it execute permissions:
  • Code:
    touch vmxrebuild.sh && chmod +x vmxrebuild.sh






  1. Copy and paste this script to the file:
    Note: for version 6.5 use the second patch instead.

    Code:
    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}
    

    1. Save the file, ensuring that it has an .sh extension.

    For version 6.5 please run the patch below instead.


    Code:
    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}

  2. If the uuid.location has changed due to operations such as cloning or Storage vMotion, run this command to get the new UUID:

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

    Note: Whenever possible, use the latest vmware.log file.
  3. Run this command to replace the old UUID in the .vmx file with the new one:

    Code:
    if [ "${NEWUUID}" ] then sed -i "s/uuid.location = .*$/uuid.location = \"${NEWUUID}\"/" ${VMXFILENAME} fi
    
    
  4. Run the script using this command:

    Code:
    ./vmxrebuild.sh

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

Comments

Popular posts from this blog

ما هى ال FSMO Roles

  بأختصار ال FSMO Roles هى اختصار ل Flexible Single Operation Master و هى عباره عن 5 Roles فى ال Active Directory و هما بينقسموا لقسمين A - Forest Roles 1- Schema Master Role و هى ال Role اللى بتتحكم فى ال schema و بيكون فى Schema Master Role واحد فى ال Forest بيكون موجود على Domain Controller و بيتم التحكم فيها من خلال ال Active Directory Schema Snap in in MMC بس بعد ما يتعمل Schema Register بواسطه الامر التالى من ال Cmd regsvr32 schmmgmt.dll 2-Domin Naming Master و هى ال Role المسئوله عن تسميه ال Domains و بتتأكد ان مفيش 2 Domain ليهم نفس الاسم فى ال Forest و بيتم التحكم فيها من خلال ال Active Directory Domains & Trusts B- Domain Roles 1-PDC Emulator و هى ال Role اللى بتتحكم فى ال Password change فى ال domain و بتتحكم فى ال time synchronization و هى تعتبر المكان الافتراضى لل GPO's و هى تعتبر Domain Role مش زى الاتنين الاولانيين و بيتم التحكم فيها من خلال ال Active directory Users & Computers عن طريق عمل كليك يمين على اسم الدومين و نختار operations master فى تاب ال PDC Emu

Recreating a missing VMFS datastore partition in VMware vSphere 5.x and 6.x

    Symptoms A datastore has become inaccessible. A VMFS partition table is missing.   Purpose The partition table is required only during a rescan. This means that the datastore may become inaccessible on a host during a rescan if the VMFS partition was deleted after the last rescan. The partition table is physically located on the LUN, so all vSphere hosts that have access to this LUN can see the change has taken place. However, only the hosts that do a rescan will be affected.   This article provides information on: Determining whether this is the same problem Resolving the problem   Cause This issue occurs because the VMFS partition can be deleted by deleting the datastore from the vSphere Client. This is prevented by the software, if the datastore is in use. It can also happen if a physical server has access to the LUN on the SAN and does an install, for example.   Resolution To resolve this issue: Run the  partedUtil  command on the host with the issues and verify if your output

Question كيفية عمل share للـ outlook conntact لكل الـ Domain Users

  الحل بسيط جدا عايز الكونتاكت تتحدث دايما بحيث انك لما تضيف يوزر جديد يسمع في الكونتاكت اول حاجه بتدخل علي in office 2003 tools --- email account ---- add address book --- internet directory service (LDAP) type your server name then login info . mark this server require me to logon type any user on active directory and its password then save and close outlook and open it again now you will find all your active directory users in address book