When making a backup plan, ESXi virtual machines, namely the guest machines, are always taken seriously because there are important production data directly stored on them. Except for gust machines, are there any other things worth backing up?
Except for guest-level backup, you can also perform a host-level backup to save data and it means backing up the entire ESXi host to backup the VMs indirectly.
Some IT administrators would like to backup vCenter to save the vCenter Server core configuration, inventory, historical data, etc. Some would also like to backup ESXi host configuration. Why you need the configuration?
Like the guest, errors could also happen to ESXi host, having the host configuration might help you fix the errors. The ESXi configuration backup might also help you quickly configure a new ESXi host.
However, there are some limitations to using ESXi backup. For example, you can only use the backup on the host with the same version of ESXi installed so a host backup might be better for this.
How to backup and restore ESXi host configuration with ESXi command line?
1. Connect to ESXi host via SSH.
2. Run the command below:
vim-cmd hostsvc/firmware/sync_config
This command is to make sure that all the changes of configuration would be saved to the target file.
3. Run the command below:
vim-cmd hostsvc/firmware/backup_config
This command is to generate the link to download the file containing the host configuration. It is like http://*/downloads/123456/configBundle-xx.xx.xx.xx.tgz.
You need to be aware that the "*" is the IP or FQDN of the host so you should manually replace it.
4. Open a web browser and copy and paste the link into it. Type Enter.
The backup file would be downloaded then. It could be found in the folder Download whose name contains "configBundle" and host FQDN. That's the way to export ESXi configuration.
Restore with ESXi command line
Note: Recovering host configuration in this way would result in an automatic reboot.
1. Rename the backup file into "configBundle.tgz".
2. Run the command below:
vim-cmd hostsvc/maintenance_mode_enter
This command is to put the ESXi host into maintenance mode
3. Copy the backup file to ESXi host
4. Run the command below:
vim-cmd hostsvc/firmware/restore_config /backup_location/configBundle.tgz
You should replace "/backup_location" with the actual directory.
How to backup and restore ESXi host configuration with vSphere CLI?
vSphere CLI, namely the vSphere Command-Line Interface, could run against ESXi or vCenter Server. It could be used as ESXi configuration backup tool. However, it is not supported since vSphere 7.0, so check whether it could be used in your virtual infrastructure.
1. Download vSphere CLI from VMware and install it.
2. Run the command below:
vicfg-cfgbackup --server=ESXi_host_IP_address --username=root -s output_file_name
You should replace "ESXi_host_IP_address" and "output_file_name" with the actual content.
The backup file could be found in the directory of where you run the vicfg-cfgbackup script.
Restore with vSphere CLI
1. Put the host to maintenance mode
2. Go to the server of vSphere CLI, and run the script
vicfg-cfgbackup --server=ESXi_host_IP_address --username=root -l backup_file
You should replace "ESXi_host_IP_address" and "backup_file" with the actual content.
How to backup and restore ESXi host configuration with vSphere PowerCLI?
1. Download vSphere PowerCLI from VMware and install it.
2. Run the command below:
Get-VMHostFirmware -VMHost ESXi_host_IP_address -BackupConfiguration -DestinationPath output_directory
You should replace "ESXi_host_IP_address" and "output_directory" with the actual content.
The backup file could be found in output directory.
Restore with vSphere PowerCLI
1. Run the command below to put the host to maintenance mode:
Set-VMHost -VMHost ESXi_host_IP_address -State 'Maintenance'
You should replace "ESXi_host_IP_address" with the actual content.
2. Run the command below to restore the configuration
Set-VMHostFirmware -VMHost ESXi_host_IP_address -Restore -SourcePath backup_file -HostUser username -HostPassword password
You should replace "ESXi_host_IP_address" "backup_file" and "password" with the actual content.