Backup ESXi Config Files

Loading

Backing up the ESXi host configuration is essential for maintaining a stable VMware vSphere environment. The host’s settings—network, storage, security, and resource configurations—are crucial to its operation. In the event of a failure, restoring these configurations manually can be both time-consuming and error prone. Having a backup ensures quick recovery without having to set up a new ESXi server from scratch we would be able to recover the hosts quickly if we maintain a copy of config file. This process is valid for hosts with no TPM chip on it so here’s a guide to help you efficiently backup and restore your ESXi host configuration. The ESXi configuration is saved automatically to the /bootbank/state.tgz file every hour.

ESXi utilizes two key partitions:

  1. /bootbank: This partition stores the current ESXi image, including a compressed file named s.v00, which is essential during the boot process.
  2. /altbootbank: This partition is initially empty but is filled with the previous image during an upgrade so treat it as a backup location.

Identify the ESXi UUID

# Commmand to display the UUID of ESXi host
[root@vcf-esx01:~] esxcfg-info -u

Identify the ESXi build and version

[root@vcf-esx01:~] vmware -vl

The backup process of an ESXi involves saving the current configuration file from its default location under /scratch to an alternate location. ESXi by default does a config dump each hour to a location under the /scratch to preserve the state of its config, thus it was the need the scratch logs be moved to a shared datastore. If our scratch is not yet from its default to a shared datastore, we will need to copy the file from /scratch/downloads to a shared datastore path as that will be replaced every hour or so as ESXi does is config backups again each hour or so.

To create a new copy of the config file,

Flush the current ESXi configuration to persistent storage by running the command.

vim-cmd hostsvc/firmware/sync_config

To back up the ESXi host configuration,

vim-cmd hostsvc/firmware/backup_config

The archive file generated has a Manifest file that lists the version and build of each host that is backed up which is useful for doing restores as these have to match always . A copy of the archive file is stored in /scratch/downloads and this is the configuration backup of ESXI host and will need to be copied across to an alternate path

Once the backup is generated, you can download it via your browser. The bundle is saved as a .tgz file, which you can access by navigating to a web browser or using winscp

If the above file can’t be downloaded via weblink, copy the file from /scratch/downloads to an alternate datastore path as that will be replaced every hour or so as ESXi does its config backups again on its own

find /scratch/downloads/ -name \*.tgz -exec cp {} /vmfs/volumes/66ed5f36-4e749006-65f1-005056a3cddd/ESXi_config_backup_$(date +’%Y%m%d_%H%M%S’).tgz \;

(Visited 3 times, 1 visits today)