ESXi Config Backup & Restore

The state.tgz file

One nice thing only a very few people know is the configuration file “state.tgz” of ESXi. If you’re using a SD-Card or USB Stick installation of ESXi, the boot image is stored on that USB / SD Card.

The boot process

During bootup, ESXi loads the configuration from /bootbank/state.tgz and extracts its contents to /etc. During the day, if the file gets updated, changes are backed up into state.tgz and placed to /bootbank again.


Imagine the day, ESXi tells you there’s something wrong with /bootbank. At a closer look you see the SD Card suddenly died today. First – yes realize that – you’re happy ESXi and all VM’s are still up and running. You’ll be able to vMotion everything off that host and put him into maintenance mode.

Now, this is the right and latest time to create a config backup – if you didn’t before 🙂

Create a config Backup

To backup your ESXi configuration from USB / SD Card, follow this steps:

  1. Logon to your ESXi Host using SSH
  2. Run the script to confirm you have an up-to-date host configuration saved in the /bootbank/state.tgz file
  3. scp the file /bootbank/state.tgz to some safe location

Reinstall ESXi

If you’re in the same situation like me, it’s now time to shutdown the Host and reboot. You’ll see, the Host will not come up – yes because of the defective SD. 😛 Now insert a new SD Card, use ESXi boot media / installer and start from scratch.

After ESXi is installed again, just give him an IP and root passwort to be able to connect using ssh and continue with the restore process.

Restore Configuration

To restore the configuration:

  • scp the backup state.tgz to /tmp
  • Login using ssh
  • cd /tmp
  • tar -xvzf /tmp/state.tgz
  • cd /
  • mv local.tgz local.tgz.old
  • cp /tmp/local.tgz .
  • tar -xzvf local.tgz
  • Reboot the ESXi Host

The Host now starts with the restored configuration from your state.tgz file.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s