With the rise of ESXi I have often found myself simply redeploying the hypervisor in order to overcome an issue. Why? Because it literally takes minutes to reinstall ESXi and when you have a big customer being effected by an outage, your first priority is to bring the environment up. Yeah you still have HA and what not, but you still need to bring all the hosts in the cluster up and functional as soon as possible so that you dont find yourself in a situation where you have lost another host. Yes, I am all for finding the root cause but sometimes my curiosity is not as important as the customer’s application. In reality it never is. Plus what if your cluster just happens to be a two host cluster (dont ask me why, but I have seen that as well), in this case bringing the other host up is of paramount importance unless you dont mind being caught with pants down.
So let’s say you reinstall ESXi and that really takes a few minutes. However their might be things you do to customize your hosts like licensing info, multipaths, local users, switchs etc etc. I think you get the idea. Soon you will realize that its really stuff like this what ends up consuming your time. So what you do? In comes vMA. You can use vMA to backup your host configuration to a file and use that file to restore the changes you made to the host. This will save you plenty of time. Follow these simple steps.
Backup:
Login into vMA and set the vifptarget to the server you want to back up. To do that run:
vifptarget -s servername/ip (This is assuming you have already added the server in question using the vifp addserver command — fast pass)
Once the target has been set
vicfg-cfgbackup -s /location/BackupFileName
Your host configuration is now saved.
If you dont want to do a vifp addserver and then set the target to this host in vMA for whatever reason, you can also run:
vicfg-cfgbackup -s -server IPaddrOfHost /location/BackupFileName (This command will prompt you for a username and pwd as the vMA appliance doesn’t have this. Note the -s stands for save).
You can then FTP or SCP into the vMA appliance and grab this configuration file and store it in a safe/accessible location. Notice I said “accessible” because its important for you to have backups, but these backups are not of any value if you can’t get to them when you need ‘em.
Restore:
You can restore the configuration using the following command from your vMA appliance:
vicfg-cfgbackup -l -server IPaddrOfHost /location/BackupFileName (Note the -l stands for load)
You will be prompted for a username and password and you will also have to type YES as the prompt will say.
Keep in mind you will have to reboot your host after the restore completes.
Some use cases:
Let’s say you accidentally deleted a vswitch on your host. Instead of trying to replicate what another host has and increase your chances of missing a thing or two (maybe promiscuous mode was enabled as you run an IPS device on this host/cluster), you can simply use the above command to restore the backup for this particular host, restart your host and you are all set.
You decided to reinstall ESXi on the host. You will notice once you begin that process your host in vCenter will now be down. As you complete the install for ESXi and assign your host the static IP addr, you can then restore the config using the above commands and reboot your host. Log back into the vCenter and try to reconnect the host. The agent will get redeployed on this host and once that is completed, you will notice that all your settings are in place and DRS can happily move VMs on this host.
You can probably use powercli/vcli to do the same. My personal favorite is vMA although I use powercli/vcli for other things.





two thumbs up !!! good mix of KB and howto
Thanks! Hope its helpful
Great! Now can I use vicfg-cfgbackup to save my configuration in ESXi 4, rebuild the host to vSphere 5 and run vicfg-cfgbackup to get all my settings back?
I have personally not tried upgrading from 4.x to 5 using this method but if you have a lab it wouldn’t hurt to try it. This person had to redo the networking, take a peek http://communities.vmware.com/thread/331308
Also have you considered using VUM for upgrading. There are several options to upgrade from 4.x to 5. This is a nice post to ref http://www.ivobeerens.nl/2011/08/18/upgrading-to-vmware-esxi-5/
Good luck
I am not trying to “upgrade” per say, just rebuild from scratch host by host and it would be nice to be able to export the config on the V4 host, install V5 and reimport the config in V5 and do the same for all the other hosts in order to get a clean install. I have considered VUM however it falls in the Upgrade process and we want to start fresh for every big release from VMWare so it wouldn’t work in our case.
Nonetheless, thank you for the links and reply. I’ll look into it.
Cyril
Great article!
Any way of answering this question ‘The restore operation will reboot the host.
Type ‘yes’ to continue:’ without the need to type ‘yes’??