This came up on #VMware on Freenode this weekend. Basically the concern was “How do I Backup my ESXi USB Key?” Other than ripping the USB key out of a production machine… how was the user to do this? Well, vMA and the vCLI provide a method for this:
Backing up your ESXi Configuration:
To backup your ESXi configuration you’ll be using the vicfg-cfgbackup.pl command as follows:
- Download either the vMA or vCLI
- Launch vicfg-cfgbackup.pl:
C:\Program Files\VMware\VMware vSphere CLI\bin>vicfg-cfgbackup.pl –save –server 192.168.15.253 –username root –password password backup.bak - Note: The backup will be stored relative to your user “AppData” path:
C:\Users\Username\AppData\Local\VirtualStore\
Restoring your ESXi Configuration:
Restoring your ESXi config can be done after you have the host up and responding over the network again by using the following:
C:\Program Files\VMware\VMware vSphere CLI\bin>vicfg-cfgbackup.pl –load –server 192.168.15.253 –username root –password password backup.bak
Note: You will be asked to reboot the host on restore.
Backing up multiple hosts! – There is a script to backup multiple ESXi hosts on the VMware communities site here. Also in PowerCLI here!
[Edit: Added link to backup multiple ESXi hosts from William in the comments. Thanks William!]
[Edit 2: Added PowerCLI link from NiTRo. Site is in French, PowerCLI is not]
Here's a script that can be used to help backup and manage multiple ESXi backups: http://communities.vmware.com/docs/DOC-11767
Excellent, thank you sir!
What information is backed up by this script? Does not include Nic Team failover order and active/stand by configuration?
Another question is it possible to modify some details in this .bak like hostname, IP and apply to another ESXi host? This would rock as it opens capability if create a template for rapid deployments at remote sites where there is no infrastructure is setup…
And here is the powershell way to do it : http://www.hypervisor.fr/?p=1337
Added, Thanks!
The script relies on IP connectivity to work, so you would still need to configure the host and get it onto the network first. As for creating and deploying ESXi hosts, once you have the host on the network you can join it to your vCenter and apply a host profile to cover your additional config.
Thanks for the details. Host profiles are cost prohibitive for small
businesses or large number of remote site with single host setup. As
well remote sites do not have cetral management network. Good example
would be dealer stores with minimal server infrastructure.
Assuming IP is configured can customize the backup config and apply to
another host?
Interesting… Looking into that.
everytime I type the command, the file vicfg-cfgbackup.pl just opens up in notepad.
I am using esxi 4 U1-208167 (free esxi) and trying to get a copy of my config file in case I need to reinstall esxi. I cannot get this to work. Everytime I type the command, the file “vicfg-cfgbackup.pl” just opens up in notepad on my local pc. Here is the command that I am typing into the dos command prompt when I go to c:Program FilesVMwareVMware vSpehe CLIbin>vicfg-cfgbackup.pl –save –server 192.168.15.253 –username root –password password backup.bak
I am doing this after I downloaded and installed VMware-vSphere-CLI-4.1.0-254719.exe on my Windows 7 pc. I have tried different variations of above command. Every single time I run the command, the file vicfg-cfgbackup.pl just opens up in notepad in my Windows 7 pc. Don’t understand what I am doing wrong. Please help. All I need to do is make a copy of my esxi host config file to back and be able to restore if needed.
When you are running this command, are you running it after executing the vCLI from your start menu?
**SOLVED**
I needed to add “perl” before the actual command “vicfg-cfgbackup.pl –save –server 192.168.15.253 –username root –password password backup.bak”
example: perl vicfg-cfgbackup.pl –save –server 192.168.15.253 –username root –password password backup.bak
none of the docs that ive read tell me to add the word perl. works with it, does not work without it.
Thank You
Here is another useful windows binary to automate this process : http://slymsoft.com/esxi-conf-backup/
Please note that there is no need to provide the “-password ” part on the command line; If you omit it the tool will ask you to enter a password in a more secure fashion. It doesn’t print it out and you don’t have to write it out and it won’t show up in a process list.
Excellent! Good catch.
Backup worked fine.
Restore failed with message:
Error connecting to server at ‘https://localhost/sdk/webService’: Perhaps host is not a vCenter or ESX server
vicfg-cfgbackup.pl –server -l
works for me
This is not working for me, no errors, but no backup either?
Have you tried some of the advice from the comments? I wrote the post back on esxi 4.0, things might have changed a bit in different versions.
Also, are you specifying a location for the backup file? It may be defaulting to somewhere else unless you are explicitly calling it out.
Restore failed: fault.MismatchedBundle.summary
Were you restoring between versions (different builds even)?
Thank you soooooooooooo much!
There is a free Open Source tool we just launched XSIBackup that allows programming of unatendded backups with automatic space provisioning when the backup disk is full and a complete e-mail report after each backup
http://33hops.com/xsibackup-vmware-esxi-backup.html
use the -f switch to force the restore
This can be used to configure multiple VM hosts.
We have 8 hosts connected to 10 VLANs and 12 Datastores and it’s a pain to do the configs individually.
So we used this tool.
BE WARNED however. This tool will restore almost everything including VM configs of VMs that were running at the time of the backup. It will also restore management IP addresses and other VMKernel IPs as well as information on the vCentre that manages the host.
If you are going to use this tool to replicate configs to other hosts then make sure your source host does not have any VMs on it, nor is it connected to a vCentre. Otherwise you will bring your entire environment down instantly due to conflicting IPs and other configs.
I’ve been trying to find out what was wrong with my backup for hours… until I found your page 😀 no where else does it say the correct place where file is stored. THANKS 😀