ESXi Backup Strategy Guide

Overview

This guide explains the comprehensive ESXi backup strategy using multiple scripts for different scenarios and backup types.

Backup Components

1. VIB and Package Information

What: Installed packages, drivers, and third-party software Why: Essential for rebuilding host with same capabilities Script: backup-esxi-vibs.sh

2. Full Configuration Backup

What: Complete host settings, network config, storage, etc. Why: Enables full host restoration Script: backup-esxi-config.sh

3. VM Backups

What: Virtual machine files and configurations Why: Protect workload data Method: Separate VM backup solution

Backup Scripts Comparison

Script Purpose What it Backs Up When to Use
backup-esxi-vibs.sh Remote VIB inventory VIBs, network, storage config Regular scheduled backups
backup-esxi-config.sh Full config backup Complete host configuration bundle Before major changes

Daily/Weekly Automated Backups

Run from your workstation:

# Backup all ESXi hosts' VIB information
./scripts/backup-esxi-vibs.sh

This creates centralized backups at:

~/backup/homelab/esxi-backups/
├── esxi-nuc-01/
│   └── 20240120_143022/
│       ├── vibs/
│       ├── config/
│       └── scripts/
├── esxi-nuc-02/
└── esxi-ms-a2-01/

Before Major Changes

Run from your workstation:

# Backup all hosts' configurations
./scripts/backup-esxi-config.sh

# Or backup specific host
./scripts/backup-esxi-config.sh esxi-nuc-01

This creates configuration backups at:

~/backup/homelab/esxi-config-backups/
└── <hostname>/
    └── 20240120_143022/
        ├── configBundle-*.tgz
        ├── esxi-version.txt
        ├── hostname.txt
        └── RESTORE-INSTRUCTIONS.txt

Backup Types Explained

VIB Backup (Package Level)

  • Lists all installed VIBs
  • Documents software versions
  • Captures third-party drivers
  • Useful for rebuilding similar host

Configuration Backup (System Level)

  • Complete host configuration
  • All settings preserved
  • Network configurations
  • Storage configurations
  • Can restore to identical hardware

Restoration Scenarios

Scenario 1: Rebuild Host with Same Software

# Use VIB list from backup to reinstall packages
cat ~/backup/homelab/esxi-backups/esxi-nuc-01/*/vibs/vib-list.txt

# Install specific VIBs
esxcli software vib install -d /path/to/vib

Scenario 2: Complete Host Restoration

# After fresh ESXi installation
vim-cmd hostsvc/firmware/restore_config /tmp/configBundle-*.tgz
reboot

Scenario 3: Migrate to New Hardware

  1. Install fresh ESXi on new hardware
  2. Use VIB list to install same packages
  3. Manually configure settings (config backup may not be compatible)

Best Practices

Backup Frequency

  • VIB Backups: Weekly or after changes
  • Config Backups: Before updates, monthly
  • VM Backups: Daily (separate solution)

Backup Retention

  • Keep last 30 days of VIB backups
  • Keep last 3 config backups per host
  • Archive before major upgrades

Testing Backups

  • Periodically verify backup files
  • Test restoration procedures
  • Document any issues

Automation Options

Cron Job on Workstation

# Add to crontab for weekly VIB backups
0 2 * * 0 /home/user/scripts/backup-esxi-vibs.sh >> /var/log/esxi-backup.log 2>&1

PowerCLI Alternative

For vCenter-managed hosts:

Get-VMHost | ForEach-Object {
    Get-EsxCli -VMHost $_ | Select -ExpandProperty software.vib.list()
}

Storage Considerations

All Backups Now Remote

  • Centralized on workstation at ~/backup/homelab/
  • Protected from ESXi host failures
  • Easy to sync to cloud/NAS
  • No need to manage ESXi datastore space

Backup Organization

~/backup/homelab/
├── esxi-backups/          # VIB inventories (frequent)
│   └── <hostname>/
│       └── <timestamp>/
└── esxi-config-backups/   # Full configs (before changes)
    └── <hostname>/
        └── <timestamp>/

Troubleshooting

SSH Key Issues

# Regenerate SSH keys
./scripts/deploy-esxi-ssh-keys.sh

Datastore Space

# Check available space
esxcli storage filesystem list

Backup Verification

# Verify VIB list is complete
wc -l ~/backup/homelab/esxi-backups/*/vibs/vib-list.txt

Summary

A complete ESXi backup strategy includes:

  1. Regular VIB backups (remote)
  2. Configuration backups before changes (local)
  3. VM-level backups (separate solution)

This multi-layered approach ensures you can recover from various failure scenarios while maintaining operational flexibility.


This project is for educational and home lab purposes.