Saving ESXi Configuration State

Contents

Saving the configuration state of a standalone ESXi server will allow for the restoration of all configurations if a new instance is installed. This will include all virtual machines registrations, switches, port groups, and system configurations.

Backing Up State

Running auto-backup.sh will write the current configuration onto the disk, which is stored in /bootbank/state.tgz. ESXi has a cronjob that will run this script every hour, however, if there was a change made recently and you are backing up the configuration it would be best to run this script.

1
[root@current-esxi:~] auto-backup.sh

The /bootbank/state.tgz file is an archive that contains another file named local.tgz. Inside local.tgz are configraiton files from the /etc/ folder.

In order to backup the configuration of ESXi this file must be saved. In this example I am saving it to my laptop by copying it with scp.

1
[user@laptop]$ scp root@esxi:/bootbank/state.tgz .

Restoring State

Assuming that the previous ESXi instance is not around anymore, perhaps the USB it was on broke or maybe it was wiped, a new instance is installed. In order to restore the configuration begin by copying the state.tgz file to the new instance of ESXi.

1
[user@laptop]$ scp state.tgz root@esxi:/tmp

After extract the state.tgz file, this will result is a new file named local.tgz being extracted.

1
2
[root@new-esxi:~] cd /tmp/
[root@new-esxi:/tmp] tar -xvzf state.tgz

Copy the local.tgz file into the root of ESXi.

1
2
[root@new-esxi:~] cd /
[root@new-esxi:~] cp /tmp/local.tgz .

Now extract the local.tgz file located in the root of ESXi. This will overwrite the configuration files located on the system.

1
[root@new-esxi:~] tar -xzvf local.tgz

Run the auto-backup.sh script once again. This will update the existing /bootbank/state.tgz with the new files located in /etc.

1
[root@new-esxi:~] auto-backup.sh

Now restart the server, when it boots up the configuration should be restored.