How to backup ESXi servers

Do you backup your ESXi servers?  You don’t technically have to.  If you’ve documented your environment well, and/or you use things like host profiles, Distributed Virtual Switches, and Autodeploy, the need is lessened or even pointless.  However, if you have any manual configurations that need to persist beyond a reboot, you should do it because it’s stupid easy.  Here’s how to backup ESXi servers.

Backup ESXi servers the easy way

This is really easy if you do it with PowerCLI.  Ready?

Get-VMHost | Get-VMHostfirmware –BackupConfiguration –DestinationPath “C:\BackupLocation”

That’s it!  If you used Connect-VIServer to connect to vCenter, this one liner creates within the backup location a file for each server.  Done!

You might want to run this when:

  • You’re about to make any configuration changes.
  • Periodically in case others make configuration changes you’re not aware of.
  • Before you patch your servers.
  • After you patch your servers, and you’ve determined they’re functioning properly.
  • If the ESXi install is on storage that is reporting errors.
  • To migrate ESXi installations to different storage.

This is a great way to get your ESXi servers up and going in the event of a misconfiguration or failure in the ESXi server installation storage.

Restore from backup files

Great!  You have a backup of your ESXi servers.  How do you restore it?

Set-VMHostFirmware -VMHost <IP_or_FQDN> -Restore -Force -SourcePath C:\BackupLocation

If the ESXi server is not on the network anymore, it must be returned to a network connected state first.  You may need to reinstall ESXi first, and configure its management network first.  Then, you can use Connect-VIServer to connect directly to the ESXi server in order to run the above.

Also, be aware that configuration backups can be and almost always are ESXi server version specific.  So ensure you reinstall ESXi using the same version that the server was when the backup was taken.  Ensure you create new backups after you patch your server for this reason.

 

Leave a Reply

Your email address will not be published. Required fields are marked *