state.tgz
backup.
state.tgz
backup file.auto-backup.sh
script to confirm you have an up-to-date host configuration saved in the /bootbank/state.tgz
file.Bootbank/state.tgz
file is updated and contains the host configuration.auto-backup.sh
script. For more information, see the Saving State Locally section in the Additional Information section of this article./bootbank/state.tgz
file to a safe location (for example, a shared datastore or use WinSCP to copy to another location). state.tgz
file to the system (for example, to the /tmp
directory). local.tgz
file from the state.tgz
archive by running these commands:# cd /tmp
# tar -xvzf state.tgz
local.tgz
file under /
(the root directory) and then copy the newly extracted local.tgz
file to the /
directory by running these commands:# cd /
# mv local.tgz local.tgz.old
# cp /tmp/local.tgz .
local.tgz
file by running the command:# tar -xzvf local.tgz
/etc/vmware/esx.conf
, etc).auto-backup.sh
again, so that it collect all these new files and properly updates the /bootbank/state.tgz
file. When working with ESXi, you must understand that it was designed from the ground up to be completely stateless. If a system is diskless, the system is stateless. If a system has a disk, then the system has a state.
All the information that is stored on disk is extracted onto a root file system that does not reside on disk. This is evident especially when looking at the output of the mount command:
Unlike a conventional Linux system, there is no one to one relationship between a mount point and an on-disk partition. The mount points reside completely in memory and are stateless. Everything that is on disk is loaded during boot and once loaded, the boot device is no longer required.
What is the glue that joins the state-full information that is on disk, with the state-less information that is in memory?
Specific files located in the /etc/ directory has a special T flag. If a file with the T flag is modified, a second similarly named file will appear, that has a .# prefix. During shutdown, the /sbin/backup.sh script scans for these modified configuration files in the /etc/ directory and stores the files into the bootbanks in the form of a state.tgz file. On the next reboot, the VMware ESXi host loads the last state.tgz that was stored.
The /sbin/auto-backup.sh script detects whether any changes have occurred and whether a backup is required. This script in turn calls /sbin/backup.sh to actually perform the backup. The /sbin/auto-backup.sh script is scheduled to run every hour by the /var/spool/cron/crontabs/root file. The automatic backup of changed files can be performed manually by running the /sbin/auto-backup.sh script on an ESXi host, or it will be performed automatically at the next shutdown/reboot or hourly scheduled backup.
This phenomenon can be demonstrated by modifying the /etc/ntp.conf file:
The script stores the files in a local.tgz file which is then stored in a state.tgz file. The state.tgz is stored in the bootbank (/vmfs/volumes/Hypervisor1/). The file is a conventional TGZ file. You can extract it and see that it contains the configuration files for ESXi: