I had the joy of dealing with the USB drive which hosts my ESXi host’s OS and configuration go bad, and naturally without a backup of the configuration.
I did manage to recover enough of the drive to gain access to the “state” archive which contains the host configuration (this is stored as state.tgz).
The following steps will go over how to restore the files located in the state archive to be able to run the host in its original pre-failure state. This will NOT cover how to recover state.tgz from a failed drive as there are far too many variables to be able to cover the different ways of recovery. It is highly recommended to work with copies of all data being manipulated and not the original version. All steps below are to be tested in a lab environment and extreme caution should be used when attempted in production environments.
1. Install ESXi on the host with new media. Steps for this can be found here. To make this easier, configure the host to the point of having username/password and network connectivity. I recommend using a different IP address and username/password combination from the original failed host so that way you can verify the restored configuration takes affect.
2. Copy state.tgz to a directory on the ESXi host such as /tmp I used WinSCP, but you are welcome to whatever method is desired.
3. Navigate to the location state.tgz is stored and extract the contents (local.tgz):
4. Verify if local.tgz is already located in your root directory and rename it if it is:
5. Copy the local.tgz file from /tmp to the root directory:
6. Extract the contents of local.tgz with tar -xvzf local.tgz:
7. Run auto-backup.sh to have the extracted contents replaced with the current host’s configuration:
8. Reboot and verify your failed host has its settings restored:
9. Setup proper backups for your virtual and physical server environment! (Not included in this post).