Always Upgrading Blog

A blog (mostly) about Enterprise IT upgrades.

Backup and Restore ESXi if Incompatible When Upgrading to 6.5

Incompatible Message

As part of the seemingly never ending upgrade cycle, the last of the VMware ESXi 5.5 stragglers are being upgraded. If you’ve been through this before, you’ll probably already know that if you’ve previously upgraded a host from an older version of ESXi to 5.5 you will likely get an incompatible warning like the image above when you try to apply your Upgrade Baseline for ESXi 6.5.

The simplest fix for this is to wipe and reinstall a fresh copy of ESXi 6.5. However, if you’d like to keep your existing configuration, you can backup and restore this using the VMware PowerCLI.

Installing VMware PowerCLI if Required

This one is nice and simple on modern versions of Powershell (e.g 5), simply open a Powershell prompt as an Administrator and run:

Install-Module VMware.PowerCLI -AllowClobber

Update: If you get any errors about being unable to resolve package source, see here.

Backup the ESXi Configuration

To backup your host in vCenter, use the following Powershell snippet (note the backup folder location must existing beforehand).

# Add the VMware Module
Import-Module VMware.PowerCLI

# Connect to vCenter
Connect-VIServer -Server <your vCenter hostname>

# Backup ESXi config of all hosts in a Cluster
#Get-Cluster "<Your Cluster Name>" | Get-VMHost | Get-VMHostFirmware -BackupConfiguration -DestinationPath "C:\ESXi_Backups"

# OR (uncomment above or below as required)

# Backup ESXi config of a single host
#Get-VMHost "<Your ESXi hostname>" | Get-VMHostFirmware -BackupConfiguration -DestinationPath "C:\ESXi_Backups"

# Clean up
Disconnect-VIServer -Force -Confirm:$false
Remove-Module VMware.PowerCLI

This will create a config bundle with the filename configBundle-<your ESXi hostname>.tgz for each host you chose. We’ll use this later for the restore.

Reinstall ESXi 5.5

Now reinstall ESXi 5.5, if you want to keep any local datastores then be sure to select (X) Install ESXi, preserve VMFS datastore.

Preserve Datastore

Re-enter all the same IP configuration details and hostname as the original host from the DCUI.

Re-connect to vCenter

To restore the configuration, you’ll need to re-connect the host to vCenter again. To do this, right click your host (it’ll say not responding) and choose Connection > Connect.

Not Responding
Reconnect

You’ll receive a warning about being unable to verify the authenticity of the host’s certificate, this is expected as a new one was generated when you reinstalled ESXi. Continue through the wizard to reconnect the host, accepting the thumbprint of the new certificate when prompted.

Put the host back into Maintenance Mode once reconnected, the host must be in maintenance mode before you can restore the configuration from backup.

Restore the Configuration

Back in Powershell, run the following script to restore your configuration.

# Add the VMware Module
Import-Module VMware.PowerCLI

# Connect to vCenter
Connect-VIServer -Server <your vCenter hostname>

# Restore ESXi config of a single host, not this is done using the root password of the ESXi host
Set-VMHostFirmware -VMHost <your hostname> -Restore -SourcePath "C:\ESXi_Backups\configBundle-<your hostname>.tgz" -HostUser root -HostPassword "<your password>"

# Clean up
Disconnect-VIServer -Force -Confirm:$false
Remove-Module VMware.PowerCLI

When you run the script above, the ESXi host will immediately reboot, this is normal as it needs to reboot to load the restored configuration.

Once the server has rebooted and finished loading, the state will change from (not responding) to (disconnected) in vCenter. This is because we’ve just restored the old certificate, so vCenter cannot validate the certificate thumbprint again.

Disconnected Thumbprint Message

Simply run through the Connection > Connect wizard again to reconnect the host.

Reconnect

Troubleshooting the Restore

Very rarely, I’ve seen the host come back online once the reboot completes after the restore operation without the restored configuration in place. It’s pretty obvious when it does this as it connects automatically back to vCenter (without manual intervention) and you can’t see any of your original configuration when examining the host settings.

Thankfully the solution is pretty straight forward, simply run the restore script again. Every time I’ve seen this issue, re-running the script has successfully restored the configuration on the second attempt.

Done! Time to Upgrade to ESXi 6.5

If you rescan your host for updates in Update Manager now, it should now display Non-Compliant instead of Incompatible.

Non-Compliant

You can now upgrade to 6.5 as normal using Update Manager.


Share