Wednesday 11 January 2012

ESX Server Restore steps

A common question that arises on the VMware Communities Forum is how to backup VMware ESX so that you can restore the backup if there is a problem, the theory being that this would be faster than reinstalling the server.

As stated within the VMware KB article 1000761 it is possible to restore ESX to identical hardware; however, you need to reinstall ESX first and restore the data you backed up while making changes to how the system boots, else the Universally Unique Identifier (UUID) written by the installation will not work anymore as you have overwritten the data from your backup.

This method will restore everything effectively to identical hardware, however if you want to use new hardware, perhaps with different PCI devices, then the restoration would fail to properly configure the new devices. It may even fail to properly configure NICs if there are any IRQ differences between the supposed identical hardware.

So in these cases you would have to at least verify the configuration and fix anything that was broken. This could lead to a set of unknowns from a security perspective. You are after all trusting the backup was restored properly and if it was not, then you could end up with security issues. So the verification step would have to be extremely well documented.

It is far easier to reinstall VMware ESX to the hardware and to use a either a installation document,  kickstart, or other type of script to configure all the devices for you using either the Remote CLI or the VMware ESX CLI.

When restoring VMware ESX or VMware ESXi the best tool to have will be very good installation documentation that is easy to follow and has graphics and text for every step of the configuration.  These documents could be reviewed for security concerns, and used to derive the scripts that could do the work for you.
how to restore an ESX host to a previous configuration in the event of a failure or re-installation.

Warning: This procedure is an unsupported workaround. This may lead to corruption if done incorrectly.
Solution
Backing up Procedure
Create backups of these items:

    * The /etc/passwd file
    * The /etc/shadow file
    * The contents of /home directory
    * The contents of /root directory
    * The contents of the /etc/vmware directory, excluding:
          o Any soft links
          o /etc/vmware/patchdb
          o /etc/vmware/ssl

Restoring Procedure

To restore configuration:

   1.      Reinstall ESX to the same patch level as the failed one.
   2.      Get the information on the currently configured core dump partition and copy and paste the output into a text editor:

      esxcfg-dumppart –l

   3.      Get the information on the currently configured cos core file and copy and paste the output into a text editor:

      cat /etc/vmware/esx.conf |grep CosCorefile

   4.       Restore /etc/vmware from a previous backup.
   5.      Update the new configuration file with core dump partition information:

      esxcfg-dumppart –s vmhbaX:X:X:X

      Where  vmhbaX:X:X:X is the dump partition name noted from step 2.

   6.      Edit /etc/vmware/esx.conf and update the CosCorefile information to match the path copied in step 3.
   7.       Get the new UUID for the root partition:

      cat /boot/grub/menu.lst |grep UUID

      This generates at least 3 lines with root=UUID=xxxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx where x is a hexadecimal number.

   8.      Update the configuration with new root device UUID by executing following command

      esxcfg-boot –d “UUID=xxxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx"

   9. Reboot the ESX host. The ESX host reboots with the old profile.

No comments:

Post a Comment