Backing Up Esxi Server Configurations
Backing Up Esxi Server Configurations
Resolution
Backing up ESXi host configuration data
To back up the configuration data for an ESXi host using the vSphere CLI, run this command:
If you are using vSphere CLI for Windows, run this command:
Where ESXi_host_IP_address is the IP address of the ESXi host and output_file_name is the name of
the backup file you create.
Note: From vSphere CLI for Windows, ensure you are executing the command from C:\Program
Files\VMware\VMware vSphere CLI\bin
For example:
vSphere CLI:
Note: Use the --password=root_password option (where root_password is the root password for the
host) to avoid being prompted for the root user password when you run the script.
A backup text file is saved in the current working directory where you run the vicfg-cfgbackup script. You can
also specify a full output path for the file.
Using the vSphere PowerCLI
To back up the configuration data for an ESXi host using the vSphere PowerCLI, run this command:
Where ESXi_host_IP_address is the IP address of the ESXi host and output_directory is the name of
the directory where the output file will be created.
For example:
Note: A backup file is saved in the directory specified with the -DestinationPath option.
To synchronize the configuration changed with persistent storage, run this command:
vim-cmd hostsvc/firmware/sync_config
To backup the configuration data for an ESXi host, run this command:
vim-cmd hostsvc/firmware/backup_config
Note: The command should output a URL in which a web browser may be used to download the file. The backup file
is located in the /scratch/downloads directory as configBundle-HostFQDN.tgz
Note: When restoring configuration data, the build number of the host must match the build number of the host that
created the backup file. Use the -f option (force) to override this requirement.
To restore the configuration data for an ESXi host using the vSphere CLI:
1. Power off all virtual machines that are running on the host that you want to restore.
3. Run the vicfg-cfgbackup script with the -l flag to load the host configuration from the specified
backup file:
vSphere CLI:
For example:
Notes:
o When you run this command, you are prompted for confirmation before proceeding. You can
override this safety feature using the -qoption.
To restore an ESXi host to the stock configuration settings, run the command:
vicfg-cfgbackup --server=ESXi_host_IP_address --username=root -r
For example:
vicfg-cfgbackup --server=10.0.0.1 --username=root -r
Note: When restoring configuration data, the build number of the host must match the build number of the host that
created the backup file. Use the -force option to override this requirement.
2. Restore the configuration from the backup bundle by running the command:
Where ESXi_host_IP_address is the IP address of the ESXi host, backup_file is the name of
the backup bundle to use for the restore, and username and password are the credentials to use
when authenticating with the host.
For example:
Set-VMHostFirmware -VMHost 10.0.0.1 -Restore -SourcePath
c:\bundleToRestore.tgz -HostUser root -HostPassword
exampleRootPassword
Note: When restoring configuration data, the build number of the host must match the build number of the host that
created the backup file.
vim-cmd hostsvc/maintenance_mode_enter
2. Copy the backup configuration file to a location accessible by the host and run the command:
In this case, the configuration file was copied to the host's /tmp directory. For more information,
see Using SCP to copy files to or from an ESX host (1918).
Note: Executing this command will initiate an automatic reboot of the host after command completion.
Additional Information
Note: The information about virtual machines is not stored in the config backup and the virtual machines must be re-
inventoried from the datastore browser after a config backup restore. Also, bootbank information is not stored in a
config backup. If needed, this must be backed up and downloaded separately in a compressed tar file.
Backing Up Configuration Information with vicfg-cfgbackup section in the vSphere 5.1 Command Line
Documentation
Note: if you have installed a version of vSphere later than 5.1, see the Command Line Document and PowerCLI
Reference for that version in the VMware Documentation Library.
PowerCLI Notes:
Remember that the 64 bit version of PowerCLI is installed in C:\Program Files, and the 32 bit version
is in C:\Program Files (x86).
To be alerted when this article is updated, click Subscribe to Document in the Actions box.