How to Back & Restore VMware ESXi Configuration Using vSphere CLI
The vSphere Command-Line Interface (vSphere CLI) command set allows you to run common system administration commands against ESX/ESXi systems from any machine with network access to those systems. vSphere CLI commands are especially useful for ESXi hosts because ESXi does not include a service console. You can use vicfg-cfgbackup.pl within vSphere CLI to backup or restore your VMware ESXi 4.1 server configuration or to reset the host to factory settings.
vicfg-cfgbackup
The vicfg-cfgbackup command backs up and restores ESXi configuration data. You can back up the host configuration, restore the configuration to the host, force the restore of the configuration, and reset the host to factory settings.
WARNING! This command is supported for ESXi hosts but not for ESX hosts.
Copyright ©2011 Zubair Alexander. All rights reserved.
vicfg-cfgbackup <conn_options> [--force | --help | --load <backupfile> | --reset | --save <backupfile>]You can use the following options with vicfg-cfgbackup.
conn_options Specifies the target server and authentication information if required. Run vicfg-cfgbackup --help for a list of all connection options. --force | -f Forces the restore of the configuration. --help Prints a help message for each command-specific and each connection option. Calling the script with no arguments or with --help has the same effect. --load | -l <backupfile> Restores configuration from <backupfile> onto the host. --save | -s <backupfile> Backs up the host configuration. Include the number of the build that is running on the host that you are backing up in the backup filename. If you are running the vSphere CLI from vMA, the backup file is saved locally on vMA. Local storage for backup files is safe because vMA is stored in the /vmfs/volumes/<datastore> directory, which is separate from the ESXi image and configuration files. --reset | -r Resets the host to factory settings. --quiet | -q Performs all operations without prompting for confirmation.
Step-by-Step Instructions
Follow the instructions below for backing up and restoring your ESXi 4.1 server configuration from your Windows computer. Backing Up the Configuration- Install vSphere CLI on your Windows computer. I like to install it on Windows 7 and manage my ESXi server using vSphere Client GUI and vSphere CLI. You can download vSphere CLI here.
- Go to Start -> All Programs -> VMware -> VMware vSphere Client -> Command Prompt.
- Change directory to the folder where the vicfg-cfgbackup.pl is located. This will typically be in the C:\Program Files (x86)\VMware\VMware vSphere CLI\bin folder. Obviously, if you add the path to your system path you can run the command from any folder.
- Use the following syntax at the vCLI prompt: vicfg-cfgbackup.pl --server ip-address --username root --password your-password --save filename For example, type the following command and press Enter: vicfg-cfgbackup.pl --server 192.168.1.200 --username root --password MySecretPassword --save esxi41.bak Where 192.1681.200 is your ESXi server's IP address, MySecretPassword is your password, and esxi41.bak is the name of the backup file that will contain the server configuration settings. Note that there is a space after each double dash (--) but not after the double dash.
- After you run the command you should see the following notification and your file will be backed in the folder where you ran the command, e.g. in the VMware vSphere Client\bin folder. Saving firmware configuration to esxi4.1.bak ... Make sure you verify that the file exists by running the dir *.bak command at the command prompt.
- Go to Start -> All Programs -> VMware -> VMware vSphere Client -> Command Prompt.
- Change directory to the folder where the vicfg-cfgbackup.pl is located. This will typically be in the C:\Program Files (x86)\VMware\VMware vSphere CLI\bin folder.
- Use the following syntax at the vCLI prompt: vicfg-cfgbackup.pl --server ip-address --username root --password your-password --load esxi41.bak -f -q For example, type the following command and press Enter: vicfg-cfgbackup.pl --server 192.168.1.200 --username root --password MySecretPassword --load esxi41.bak -f -q Where 192.1681.200 is your ESXi server's IP address, MySecretPassword is your password, and esxi41.bak was the name of the backup file that contains the server configuration settings. Note that there is a space after each double dash (--) but not after the double dashes.
- More information and documentation for vSphere CLI is available here.
- A complete reference for vSphere CLI is available here.
- vSphere CLI is available for download here.
Copyright ©2011 Zubair Alexander. All rights reserved.
Leave a Comment