Search
  • Paul Kennard

Part 3: ESXi Host Backup & Recovery - Essentials

Welcome back to part 3 of the backup and recovery essentials series. In this post, I focus on how to get the ESXi host configuration backup.


The ESXi host is often viewed by many people as a disposable system, especially when thinking about how easy they are to deploy, and even more so when Host Profiles and Auto Deploy are in place within your environment.


So why are host configuration backups important?


As the post title hints “recovery”, now Host Profiles and Auto Deploy are excellent features when implemented effectively and will make host deployment and configuration easy especially when dealing with large environments, however, what can be overlooked is both features have a dependancy on the vCenter.


So from a recovery perspective, what if the vCenter is not available? Or you just plan to make a sizeable amount of host changes and want a way of easily rolling back?


So for the small amount of effort involved, having all the VMware configs ready to go for (vCenter, vDS, Host) would suddenly be real handy at getting the business back up and running or rolling back a failed change in a timely manner.


If you would like to jump to the other parts, you can use the links below:


Part 1: vCenter Backup & Recovery

Part 2: Distributed Switch Backup & Recovery

Part 3: ESXi Host Backup & Recovery


So with that said, let’s see how easy it is to obtain the host configuration just like the other configuration backups mentioned for vCenter and Distributed switch in my other posts…



Exporting All ESXi Host Configurations - PowerCLI

So exporting all your ESXi host configurations in one go from a specified vCenter is as easy as opening Powershell and run the command below changing bits highlighted to your values:

Connect-VIServer $DestinationVC -Credential (Get-Credential)
$DestinationVC =YourvCenterServer.local”
$datestamp = Get-Date -Format “dd-MM-yyyy”
$DestiationDir =d:\YourParthOrDir\+ $datestamp + “\”
New-Item -Path $DestiationDir -ItemType “Directory” -Force
Get-VMHost | Select @{Label = “Host”; Expression = {$_.Name}} , 
@{Label =ESX Version”; Expression = {$_.version}}, 
@{Label =ESX Build” ; Expression = {$_.build}} | 
Export-csv -Path $DestiationDir\"esxi-host-builds.csv"
Get-VMHost | Get-VMHostFirmware -BackupConfiguration -DestinationPath $DestiationDir
Disconnect-VIServer -Server $DestinationVC -Confirm:$false

When run it will export and label all host configurations placing everything into a date stamped folder including with a CSV file that captures the host names, versions & build numbers at that point in time.


That’s all there is to get all host configurations from the specified vCenter and with it being PowerCLI it opens up possibilities to automate the process and get it included as part of your normal backup process.


Restoring ESXi Host Configurations - PowerCLI

In this demonstration lets say a host won’t boot and continues to PSOD. Rather than doing all the host advance options, NTP, storage, networking etc.. manually IT BOD used the ESXi host backup for “mgmt-esx03.itbod365.local” to reinstate the hosts configuration.


A fresh ESXi base install was provisioned making sure the ESXi build number which must match and was the same as the one documented in "esxi-host-builds.csv" for that backup.


The first of very few steps towards recovery was to open PowerShell and connect to the host and place it in maintenance mode by running:

Connect-VIServer YourESXiFQDNorIP -Credential (Get-Credential)
Set-VMHost -VMHost YourESXiFQDNorIP -State 'Maintenance'

Following on from above run the PowerCLI below to restore from the specified backup:

Set-VMHostFirmware -VMHost YourESXiFQDNorIP -Restore -SourcePath d:\d:\YourParthOrDir\DatedFolder\configBundle-HostBundleToUse.tgz -HostUser root -HostPassword rootpassword

After it has restored the configuration the host will end the connection and reboot.


Note: The restore will revert the root password back to what it was when that backup was created.


That's it job done, after recovery everything was back in place and working as expected and again painless.

So this also concludes the VMware Host Configuration backup post and is also the final part in this series.


So wish you all well and hope you return.

ITBOD365-576x528.gif

Cloud & Virtualization Blog by ITBOD - paul kennard

linkedin.png
twitter.png
facebook.png
rss.png
Home.png
Arrow.png