Difference between revisions of "How to backup ESXi server configuration"

From Tech-Wiki
Jump to: navigation, search
 
Line 5: Line 5:
 
  vicfg-cfgbackup --server=ESXi_host --username=root -s output_file_name.tgz
 
  vicfg-cfgbackup --server=ESXi_host --username=root -s output_file_name.tgz
  
 
+
Using the vSphere CLI for Windows:
If you are using vSphere CLI for Windows:
+
 
  vicfg-cfgbackup.pl --server=ESXi_host_IP_address --username=root -s output_file_name.tgz
 
  vicfg-cfgbackup.pl --server=ESXi_host_IP_address --username=root -s output_file_name.tgz
  
Using the vSphere PowerCLI
+
Using the vSphere PowerCLI:
 
  Get-VMHostFirmware -VMHost ESXi_host -BackupConfiguration -DestinationPath output_directory
 
  Get-VMHostFirmware -VMHost ESXi_host -BackupConfiguration -DestinationPath output_directory
  
Local Backup
+
Using the ESXi Command Line:
Log in via tech support mode (local console or ssh).
+
backup.sh 0
+
 
+
Using the ESXi Command Line
+
 
  vim-cmd hostsvc/firmware/backup_config  
 
  vim-cmd hostsvc/firmware/backup_config  
  
 
Note: The command above 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: The command above 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  
  
 +
Local Backup
 +
Log in via tech support mode (local console or ssh).
 +
backup.sh 0
  
 
'''Restoring ESXi host configuration data'''
 
'''Restoring ESXi host configuration data'''
Line 27: Line 25:
 
Note: When restoring configuration data, the build number of the host must match the build number of the host on backup file and UUID (can be obtained using the command  "esxcfg-info -u") of the host should match the UUID of the host on backup file. Use the -f option (force) to override the UUID mismatch.
 
Note: When restoring configuration data, the build number of the host must match the build number of the host on backup file and UUID (can be obtained using the command  "esxcfg-info -u") of the host should match the UUID of the host on backup file. Use the -f option (force) to override the UUID mismatch.
  
Using the vSphere CLI
+
Using the vSphere CLI:
 
  vicfg-cfgbackup --server=ESXi_host --username=root -l backup_file
 
  vicfg-cfgbackup --server=ESXi_host --username=root -l backup_file
  
vSphere CLI for Windows:
+
Using the vSphere CLI for Windows:
 
  vicfg-cfgbackup.pl --server=ESXi_host --username=root -l backup_file
 
  vicfg-cfgbackup.pl --server=ESXi_host --username=root -l backup_file
 +
 +
Using the vSphere Power CLI:
 +
Set-VMHost -VMHost ESXi_host -State 'Maintenance'
 +
Set-VMHostFirmware -VMHost ESXi_host -Restore -SourcePath backup_file -HostUser username -HostPassword password
 +
 +
Using the ESXi Command Line:
 +
(Use numeric 1 as force option to override the UUID mismatch.)
 +
vim-cmd hostsvc/maintenance_mode_enter
 +
vim-cmd hostsvc/firmware/restore_config /tmp/configBundle.tgz

Latest revision as of 14:03, 15 September 2017

How to backup ESXi server configuration to remote location or local.

Using the vSphere CLI:

vicfg-cfgbackup --server=ESXi_host --username=root -s output_file_name.tgz

Using the vSphere CLI for Windows:

vicfg-cfgbackup.pl --server=ESXi_host_IP_address --username=root -s output_file_name.tgz

Using the vSphere PowerCLI:

Get-VMHostFirmware -VMHost ESXi_host -BackupConfiguration -DestinationPath output_directory

Using the ESXi Command Line:

vim-cmd hostsvc/firmware/backup_config 

Note: The command above 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

Local Backup Log in via tech support mode (local console or ssh).

backup.sh 0

Restoring ESXi host configuration data Restoring the host configuration restores the state of the ESXi along with the vSphere standard switch networking configuration.

Note: When restoring configuration data, the build number of the host must match the build number of the host on backup file and UUID (can be obtained using the command  "esxcfg-info -u") of the host should match the UUID of the host on backup file. Use the -f option (force) to override the UUID mismatch.

Using the vSphere CLI:

vicfg-cfgbackup --server=ESXi_host --username=root -l backup_file

Using the vSphere CLI for Windows:

vicfg-cfgbackup.pl --server=ESXi_host --username=root -l backup_file

Using the vSphere Power CLI:

Set-VMHost -VMHost ESXi_host -State 'Maintenance'
Set-VMHostFirmware -VMHost ESXi_host -Restore -SourcePath backup_file -HostUser username -HostPassword password

Using the ESXi Command Line: (Use numeric 1 as force option to override the UUID mismatch.)

vim-cmd hostsvc/maintenance_mode_enter
vim-cmd hostsvc/firmware/restore_config /tmp/configBundle.tgz