Backing up an ESXi host configuration

This is a quick guide on how to backup a ESXi host using the vSphere CLI from a different server.

ESXi Command Line

  1. Run on the ESXi host.

    1
    vim-cmd hostsvc/firmware/backup_config
    

    Note: The command should output a URL in which a web browser may be used to download the file.

    For example : Bundle can be downloaded at : http://*/downloads/123456/configBundle-xx.xx.xx.xx.tgz Where * denotes the host IP/FQDN. The backup file is also located in the /scratch/downloads directory as configBundle-HostFQDN.tgz

  2. Restoring the ESXi Configuration

    1
    2
    vim-cmd hostsvc/maintenance_mode_enter
    vim-cmd hostsvc/firmware/restore_config /tmp/configBundle.tgz
    

vSphere CLI

  1. Download the latest compressed tarball version of vSphere CLI (requires login) from the vmware website.

  2. Copy the file to the linux host.

    1
    scp VMware-vSphere-CLI-6.7.0-xxxxx.x86_64.tar.gz user@host:~/
    
  3. Untar the contents.

    1
    tar xzvf VMware-vSphere-CLI-6.7.0-xxxxx.x86_64.tar.gz
    
  4. Install the needed packages.

    1
    yum install -y openssl-devel libxml2-dev e2fsprogs-dev cpan libuuid-devel perl-XML-LibXML
    
  5. Run the installation script in the vmware-vsphere-cli-distrib folder.

    1
    cd vmware-vsphere-cli-distrib ; ./vmware-install.pl
    
  6. The installer will prompt to install into the default directory or a custom location, afater the installation is complete run the following to remotely backup your esxi host.

    1
    vicfg-cfgbackup --server=ESXi_host_IP_address --username=root -s output_file_name
    

    NOTE: the vSphere CLI method has been deprecated on the latest version of ESXi.

    vsphere depricated