Voici comment réaliser une sauvegarde de votre/vos serveur(s) ESX avant qu’une panne de carte SD ou de disque arrive par exemple 😉
ESXi Command Line
>> Backing up ESXi host configuration data <<
1 – To synchronize the configuration changed with persistent storage, run this command:vim-cmd hostsvc/firmware/sync_config
2 – To back-up the configuration data for an ESXi host, run this command:vim-cmd hostsvc/firmware/backup_config
Note: The command will output a URL (http://*/downloads/123456/configBundle-xx.xx.xx.xx.tgz) in which a web browser may be used to download the file.
* denotes the host IP/FQDN.
From a web browser navigate to http://Host_FQDN/downloads/123456/configBundle-xx.xx.xx.xx.tgz
In this example the IP address of the host is 192.168.0.81
The backup file will be in the /downloads directory (default to browser or choose to download to a specific directory) as configBundle-HostFQDN.tgz
Note: To restore the configuration the destination ESXi host must be the same build as the ESXi host configuration data. The host build can be obtained using the command vmware -vl .
>> Restoring ESXi host configuration data <<
1 – The configBundle-HostFQDN.tgz should be renamed as configBundle.tgz before initiating the restore command.
2 – Put the host into maintenance mode by running this command:vim-cmd hostsvc/maintenance_mode_enter
3 – Copy the backup configuration file to the ESXi host or an available datastore.
4 – Run this command to restore the ESXi hosts configuration:vim-cmd hostsvc/firmware/restore_config /backup_location/configBundle.tgz
Notes:
Add a 1 to force an override of the UUID mismatch.
For example:
vim-cmd hostsvc/firmware/restore_config 1 /tmp/configBundle.tgz
\Executing this command will initiate an automatic reboot of the host after command completion.
However, starting from vSphere 7.0 U2, the configuration could be encrypted using TPMs and in which case, the -force option will not work if the host got changed. We need the same TPM that was used on the host during backup, to restore. In other words,
from vSphere 7.0U2, the override will not work if the host has TPM enabled.