Nested environment, which is something I did quite a bit of as a customer and still continue to do so today. I could easily snapshot my Nested ESXi environment, perform my tests and then quickly rollback to my original starting state. However, when it comes to testing a physical ESXi host, it is a bit more challenging as there is no "quick" snapshot functionality as far as I was aware of. It was only until recently did I have a use case for this and picked up a nice tidbit from one of our engineers on the team. It turns out you could "snapshot" a physical or even virtual ESXi host by just backing up the state.tgz file and then restoring it. As the name suggest, the state.tgz file contains all the configurations of your ESXi host. The process is pretty straight forward:
- SCP /bootbank/state.tgz and back that up to your local system or shared storage
- Perform your tests or make changes to the system
- When you are ready to restore, copy the state.tgz back into /bootbank folder
- Login to ESXi Shell and run reboot -f which will ensure no changes are saved to our state.tgz
Once the ESXi host reboots, it will use the restored state.tgz file and your system will be back at its original state. This process is actually not new, ESXi already provides a way to backup/restore
Would this revert an upgrade? Or is it simply just configuration type parameters?
William Lam says
Good question. I don't believe so, since state.tgz is just "config" data. The bits for the release itself is spread across the other VIBs, so I would guess it would not
Fabrizio de Luca says
Besides being an interesting alternative to the "official" backup/restore process for ESXi hosts, is this procedure officially supported or does it "just work"?
If the latter, I would still use the usual esxcfg-cfgbackup command, using -s for saving the config file and -l to load it back into the host after resetting it to factory settings from within the DCUI...
William Lam says
My understanding is it is performing the same operation that vicfg/esxcfg-cfgbackup is but instead of requiring SSH access to ESXi host, you can perform the operation remotely which leverages the APIs
This method is more of a quick/dirty way if you don't want to rely on any external tools/scripts.
Haim Chibotero says
Have a look on this cool tool 🙂