Invalid VMs after restoring ESXi configuration with a new boot drive

In this situation, the boot drive of ESXi was to be replaced. The existing ESXi installation was version 7.0 U3 and the boot drive also had a local datastore.  First a backup of the ESXi configuration was made and all VMs on the local datastore were moved to temporary storage.  A fresh install of ESXi was completed on a new drive, the VMs were moved back to the local datastore and then the ESXi configuration was restored.  However when the host booted up, all of the VMs registered on the host from the local datastore showed as Invalid.

The issue is that the inventory was pointing to the unique identifier (UUID) of the old datastore which you can see in the path visible in vSphere Client /vmfs/volumes/xxxxxxxx-xxxxxxxx-xxxx-xxxxxxxxxxxx/<VM path>.   The fix is to simply update the inventory for each registered VM with the UUID of the new datastore.

  1. Access the command line of the host
  2. Determine the UUID of the new datastore using the command:
    esxcli storage filesystem list
  3. Edit the file /etc/vmware/hostd/vmInventory.xml using vi:
    vi /etc/vmware/hostd/vmInventory.xml
  4. Modify the lines with  <vmxCfgPath>  that contain the UUID of the old datastore which is in an 8-8-4-12 digit arrangement: xxxxxxxx-xxxxxxxx-xxxx-xxxxxxxxxxxx leaving everything else the same.
  5. Save and close the file
  6. Restart the management services
    /etc/init.d/hostd restart
    
    /etc/init.d/vpxa restart
  7. Refresh the vSphere Client
  8. You should now see all VMs with the status as Normal.
  9. Update the swap file location of each VM by right clicking -> Edit Settings -> VM Options -> Advanced -> Edit Configuration
  10. Look for the configuration key sched.swap.derivedName and update the UUID
  11. Save the configuration and try to start the VM
This entry was posted in Uncategorized. Bookmark the permalink.