===== VMware ESXi Backup and Restore =====
{{tag>VMware ESXi}}
==== PowerCLI ====
===Backup===
PowerCLI C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI> Connect-VIServer -server matx01vmvh01
Name Port User
---- ---- ----
matx01vmvh01 443 root
PowerCLI C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI> Get-VMHostFirmware -vmhost matx01vmvh01 -backupconfiguration -destinationpath C:\users\tingalls\Desktop
Host Data
---- ----
matx01vmvh01 C:\users\tingalls\Desktop\configBundle-matx01vmvh01.tgz
===Restore===
PowerCLI C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI> Set-VMHost -vmhost matx01vmvh01 -state 'Maintenance'
PowerCLI C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI> set-vmhostfirmware -vmhost matx01vmvh01 -restore -sourcepath c:\users\tingalls\desktop\config-bundle-matx01vmvh01.tgz -hostuser root
----
==== vCLI ====
===Backup ESXi config:===
C:\Program Files (x86)\VMware\VMware vSphere CLI\bin>vicfg-cfgbackup.pl --save --username root --server matx01vmvh01.nerdydrunk.net c:\Users\tingalls\Desktop\matx01vmvh01.bak
Enter username: root
Enter password:
Saving firmware configuration to c:\Users\tingalls\Desktop\matx01vmvh01.bak ...
# C:\Program Files\VMware\VMware vSphere CLI\bin>vicfg-cfgbackup.pl –save –server 10.2.5.80 backup.bak
# C:\Users\Username\AppData\Local\VirtualStore\Program Files\VMware\VMware vSphere CLI\bin\backup.bak
===Restore ESXi config:===
C:\Program Files\VMware\VMware vSphere CLI\bin>vicfg-cfgbackup.pl –load –server 10.2.0.200 backup.bak
----
==== ESXi Local CLI ====
===Backup ESXi config local===
http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=2042141
[root@matx01vmvh01:~] vim-cmd hostsvc/firmware/backup_config
[root@matx01vmvh01:~] find -name configBundle-matx01vmvh01.tgz
[root@matx01vmvh01:~] cp /vmfs/volumes/50cd9f85-90c255e8-a9cb-002590a14802/.locker/downloads/5231dff8-fd33-089e-d061-f4e3be007b05/configBundle-matx01vmvh01.tgz /vmfs/volumes/DS-VH01LOCL-VDPA/ISOs/
[root@matx01vmvh01:~] ls /vmfs/volumes/DS-VH01LOCL-VDPA/ISOs/
===Restore ESXi config local===
[root@matx01vmvh01:~] vim-cmd hostsvc/maintenance_mode_enter
[root@matx01vmvh01:~] cp /vmfs/volumes/DS-VH01LOCL-VDPA/ISOs/configBundle-matx01vmvh01.tgz /tmp/configBundle.tgz
[root@matx01vmvh01:~] vim-cmd hostsvc/firmware/restore_config /tmp/configBundle.tgz
----