VMware Vsphere and ESX

Version as of 02:13, 19 May 2024

to this version.

Return to Version archive.

View current version

VMware ESX Server Backup

Amanda Enterprise 3.1 allows you to backup VMware ESX images to various media supported by Amanda. The backups are performed in an application consistent manner.  These backups can be used for restoration of guest VMs running on the ESX server and can be restored to alternate ESX server. The VMware is backed up using VMware Virtual Disk APIs (Vstorage APIs) The incremental backups contain only the changed data blocks.

Zmanda recommends using Amanda client to backup files from guest VM if file level backup of VMs is needed.

Amanda Enterprise VMware ESX application supports licensed versions of VMware ESX 3.5 and 4 (Vsphere 4). Feature license for Data Recovery is required.

Requirements for VMware Server Backup and Restore

  • Amanda Enterprise 3.1 (including dependencies) must be installed on the Amanda server.
  • Make sure Amanda Enterprise server and Zmanda Management Console is functional before installing and configuring VMware ESX application.
  • Amanda VMware ESX application agent performs the backup from the Amanda server. No additional Amanda client software is required. No software is required on the ESX server.
  • Amanda server must be running  Linux distribution listed on the Zmanda Network Supported Platforms page.
  • All guest VMs being backed up should have Change Block Tracking (CBT) enabled for all the disks. This VMware operation can be performed only when guest VM is powered off. Enabling CBT might require couple of guest VM reboot cycles.
  • The ESX server must be running on VM hardware version 7. (Other hardware levels are not supported)
  • You need to install VMware vSphere VCLI (VMware-vSphere-CLI) and VMware vSphere VDDK (VMware-vix-disklib) packages from VMware. These packages have following operating system dependencies:

perl-Crypt-SSLeay

perl-URI

fuse

fuse-libs

curl

These dependencies can be installed using yum or yast or apt-get tools available in the Linux distribution. The actual names of the packages might be different in different distributions.

On RHEL systems, you can install these dependencies using:

# yum install fuse-libs fuse perl-Crypt-SSLeay perl-URI curl

On Ubuntu 8.04, following command can be used:

# apt-get install fuse-utils libfuse2 libcrypt-ssleay-perl liburi-perl curl

There are additional dependencies for some Ubuntu platforms. Following packages are also required:

libsoap-lite-perl libuuid-perl libcrypt-ssleay-perl libclass-methodmaker-perl 
libxml-libxml-perl libwww-perl libio-compress-perl libcompress-zlib-perl 
libio-compress-zlib-perl libio-zlib-perl unzip perl-doc nfs-common psmisc 
screen linux-headers-`uname -r` build-essential

VMware VCLI and VMware VDDK packages are available in the VMware web site. VMware VDDK package is also available in Zmanda Network.  You can install the VMware packages as follows:

# <extract from VMware-vix-disklib tar archive>

# <extract from VMware-vSphere-CLI tar archive>

# ./vmware-vix-disklib-distrib/vmware-install.pl

# ./vmware-vsphere-cli-distrib/vmware-install.pl

  • Amanda VMware ESX application requires temporary space to store the backup images on the Amanda server (See Installation section below).  The space required should be equal to the size of the guest VM images being backed up. This space requirement is temporary and required only during backup. The amandabackup user should be able to read and write to this directory on the Amanda server.
  • For good backup performance, there should be no snapshots of the Guest VM being backed up.

Installation

Amanda ESX VMware application is installed as part of Amanda server. Separate software is not required.

The application is licensed. Amanda VMware license must be part of Zmanda License file on the Amanda server.

If the VMware commands (vmware-cmd, vmkfs, vmware-diskmanager, snapshotmanager.pl) are not installed in default locations (/usr/lib/vmware-cli for VCLI and /usr/bin for vmware-diskmanager), you will have to modify /etc/zmanda/zmc_aee/zmc_user_dumptypes to fix the application properties (VCLI-PATH, VCLI-BIN-PATH and VDDK-BIN_PATH).

Configuring VMware Server Backups

Configuring VMware guest VM backups requires steps in both Zmanda Management Console and some manual steps.

  • Zmanda recommends creation of separate backup set for backing up guest VM images.
  • It is also important to change TEMP-WORKING-DIR location in the /etc/zmanda/zmc_aee/zmc_user_dumptypes file for zmc_vmware_userapp. This location should have sufficient disk space to hold a single uncompressed copy of the largest ESX VMware image that will be backed up. The default value is /tmp/amanda and should be changed because /tmp file system can become full during backup process.
  • Create a backup set for the guest VMs in the Zmanda Management Console. Use ZMC Backup What page to add DLEs for ESX servers as shown below. Click Add/Update to save the configuration.

BackupWhat-VMware-3.1.png

ESX Host Name is the name of the ESX server whose guest VMs are being backed up. It can be the IP address of the ESX server.

Virtual Machine Name is the name of the guest VM that should be backed up. You should not use the IP address of the guest VM. The name of guest VM that corresponds to the directory name on the ESX server storage should be used. This value is case sensitive.

Datastore Name is the name of the VMware datastore used by the guest VM.

ESX server user and password is the authentication information for the ESX server to perform backup and restores. The password should not contain white space characters. The VMware user privileges that are required are described in Creating ESX Backup User section below.

The backup data can be encrypted and/or compressed. The compression and encryption are performed on the Amanda server and can consume significant CPU/memory resources.

It is a good idea to Disable Staging for VMware DLEs because they do not add any performance for VMware application.

  • Please resolve any configuration errors found by the ZMC Backup What page.
  • Change the Data Not Sent Timeout value in the Backup How page for the backup set.  The value should be increased to at least 7200 seconds. Increasing the value does not impact the backup window (time to complete the backup).

Scheduling backups of VMware Server

You can schedule backups using Zmanda Management Console Backup When page or run immediate backups for the backup set from the Backup Activate page.

The status of the backup are shown in the Monitor page. Backup reports will be available under the Report tab in the Zmanda Management Console.

Amanda ESX Server application supports only full backups (level 0 backups).

The backups of the guest VM are performed by taking snapshots of the disks associated with the guest VMs. Snapshots are removed after the backup data is copied over. Under certain circumstances, the snapshots are not removed. It is important to remove the backup snapshots.

Performing VMware Server Restores using ZMC

Zmanda Management Console can restore the VM directly to another or the original ESX server. It can also extract the files on the Amanda server.  When the files are extracted on the Amanda server, they have to be transferred to the ESX server to complete the recovery.

The ZMC recovery process starts at Restore What page. Enter the Backup Date - the timestamp of the backup run. The Host Name in case of VMware is always 127.0.0.1. Enter the guest VM name in \\<esx server name>\<datastore name>\<guest VM name> format.

RestoreWhat-VMware-3.1.png

In the Restore Where page, Select Destination Host as localhost. The Destination Directory can be one of the following:

RestoreWhere-VMware-3.1.png

  • Original Location: Backup to the original ESX server with the same guest VM name. Please make sure the guest VM no longer exists on the original ESX server.
  • Destination Directory: A directory on the Amanda server which sufficient space to store restored images. Example: /tmp/vmware-restore
  • VMware: //<esx server name>/<datastore name to restore to>/<guest vm name> if the VM has to be restored to the ESX server and started on the ESX server. The guest VM name and ESX server can be different from the original VM name and the ESX server.

After reviewing the entries, Click Restore button on the Restore Restore page to start the restore process as shown below:

RestoreRestore-VMware-3.1.png

If raw files are being restored (see Restore Where page), the restored files will reside on the Amanda server destination directory.   Use the following steps to complete the VM recovery on the ESX server.

  • In the destination directory, all the VMDK files and .vmx files will be restored.
  • These VMX and VMDK files will have to converted to OVF format.  To convert the files into OVF, use ovftool or VMware vCenter Convertor. The ovftool is available from VMware. For example:

To generate an OVF file and copy the virtual machine to ESX server in a single step, use

# /opt/vmware/ovftool/ovftool -ds=<datastore> <Name of vmx file to be copied> vi://<user name>@<ESX host>/

Generate an OVF file. Copy the contents of the directory to the ESX server and import it using Vsphere console.

# /opt/vmware/ovftool/ovftool <vmx file name> <ovf file name>

Performing VMware Server Restores/Recovery using command line

This section describes how to use Amanda recovery command amrecover to perform ESX guest VM recovery.  This procedure can be used to restore guest VM to the original ESX server. These steps can be used instead of the procedure described in the previous section.

  1. Run amrecover command on the Amanda server as root user. You will need to provide the backup set name as a parameter. The values for options -t and -s will not change.

        # amrecover -C <backup set name> -t localhost -s localhost
     
  2. Set the host to localhost and the disk to DLE name that was used in the backup set configuration. The DLE name will have //<ESX server name>/<name of the guest VM>. The setdisk parameter must match the name (include escape characters) that was specified in the disklist.conf configuration file.


amrecover> sethost localhost

200 Dump host set to localhost.

amrecover> setdisk //192.168.1.2/rhel4-32

200 Disk set to //192.168.1.2/rhel4-32

  1. To restore the VM to a different ESX server or to different VM name, user setproperty sub-command. If this property is not specified, the VM will be restored to original ESX server and original VM name.

amrecover> setproperty directory //192.168.1.3/datastore2/amanda-restore

 

  1. You list the files in the backup using ls command. Add all the files to be restored and run extract command to restore the files.

amrecover> ls

2010-03-03-17-22-35 rhel4-32.vmx
2010-03-03-17-22-35 rhel4-32.vmdk
2010-03-03-17-22-35 .


amrecover> add *
Added file /rhel4-32.vmx
Added file /rhel4-32.vmdk


amrecover> extract

  1. The VMDKs will be restored to the ESX server and the datastore.

 

Creating ESX Backup User

For VMware backup and restore operations, the ESX user that is specified in the ZMC Backup What page should have certain roles. You can use the following procedure to create an user with minimal privileges for backup and recovery.

  1. Select View > Administration > Roles
  2. Select Add Role.  Select an unique name for the role. For example: backup-role
  3. Select the list of privileges for this role as shown below and click OK to save the role configuration.

 VMware-Backup-Privileges (1).png

After creating the role, assign the role to specific user that can be used for VMware backups.

  1. Using VMware Vsphere Client, Log in to the ESX server.
  2. Select the host in the inventory and click on the Permissions tab.
  3. Select the user name and use the right-click menu to select Properties.
  4. Assign the backup role to this user.