VCP 5 – Objective 5.5 – Backup and Restore Virtual Machines

Identify snapshot requirements

Snapshots preserve the state and data of a VM at a particular point in time.  They are useful as a short term solution for testing software with unknown potential.  You can take multiple snapshots a VM.  Each branch within a snapshot tree can contain up to 32 snapshots.  A snapshot preserves the following
  • VM settings – the VM folder including disk that were added or changed after the snapshot has been taken.
  • Power State – Whether the VM was powered on, off or suspended.
  • Disk State – state of all the VMs disks.
  • Memory State (optional).  The contents of the VMs memory

Each snapshot has a parent and a child, except for the last snapshot which has no child.  Each parent can have one more child snapshots.  You are able to revert to either the current parent snapshot, or any parent or child snapshot from within the tree.  Each time you revert to a snapshot and take another, a new branch or child snapshot is created.

When you take a snapshot of a VM, you can also chose to quiesce the VM files.  In order to quiesce a VM you need to have VMware Tools installed.  A quiesce operation ensures that a snapshot disk is in a consistent state.

Taking a snapshot of a VM will create several files depending on the amount of disks you have assigned to the VM and whether or not you decide to capture the VMs memory state along with the snapshot.  A snapshot can create the following files.

  • Delta disk files – This is a .vmdk file that the guest operating system has write access to.  This will store the deltas or differences between the current state of the virtual disk and the state that existed at the time of taking the snapshot.  A delta disk, just as a standard virtual disk contains two files.  A descriptor file that contains information about the disk and a corresponding file that contains the data (this disk is represented by a -flat.vmdk).
  • Database File – This is a .vmsd file that contains the VMs snapshot information.  This is the primary file accessed by the snapshot manager as it contains line entries defining the relationships between snapshots and between the child disks for each snapshot.
  • Memory File – This is a .vmsn file that includes the active state of the VM.  This allows you to revert to a VMs powered on state, whereas if you chose not to capture the memory you can only revert to a 'turned off' VM state.  Including the VMs memory in the snapshot will delay the time it takes to snapshot the VM as it needs to dump the VMs memory to disk (more memory the VM has, the longer it takes).

There are a few requirements/restrictions when using snapshots

  • RDM in physical compatibility mode are not supported
  • Nor are VMs utilizing in guest iSCSI.
  • Direct Path is not supported
  • VMs with independent disks must be powered off before you can take a snapshot.  Powered On or suspended VMs are not supported if configured with independent disks.
  • Bus Sharing not supported
  • Provide a point in time image of a disk that backup solution can use, but are not meant to be the backup as snapshot files could grow and fill a datastore, or be lost making the VM unusable.
  • They can negatively affect performance of a VM depending on how long the snapshot has been taken and how big the snapshot files are.  Might delay a VMs power on time.
Create/Delete/Consolidate virtual machine snapshots
 
Creating (Taking Snapshots)
  1. Right click the VM and chose Snapshot -> Take Snapshot
  2. Give the snapshot a name and a description (description is optional).
  3. Select whether or not to snapshot a VMs memory.
  4. Select whether or not to quiesce the guest file system.
  5. Click OK -> DONE!

Deleting Snapshots

Deleting Snapshots is basically committing all of the writes since the snapshot was changed.  It removes the snapshot from the snapshot Manager and the snapshot files are consolidated and written to its' parent snapshot disk and merged with the Virtual Machine base disk.  When you delete the base parent snapshot, all changes will merge with the base disk.  This involves large amounts of disk reads and writes, which can most certainly reduce performance until it is complete (which can take a little bit of time depending on the size of the snapshots).  There are a couple of options for deleting snapshots, both are present within the Snapshot Manager. 

  • Delete – This will remove and consolidate a single parent or child snapshot.  Delete can also be used to remove a corrupt snapshot or files from an abandoned branch of the tree (this will not commit changes.).
  • Delete All –  This option will delete all snapshots from the snapshot manager while writing changes from the child and parent disks all the way up to the base virtual machine disk..

To prevent snapshot files from merging changes or in the presence of failed updates or patches you can use the Go To command to restore to a previous snapshot.  You can then use the 'Delete' option to delete snapshots underneath that point one by one.

Consolidating Snapshots.

The snapshot consolidation command searches for hierarchies that it can combine without violating any snapshot dependencies.  Once consolidate all redundant disks are removed from the Snapshot Manager.  This is useful when disks fail to compact after a delete operation and/or disks did not consolidate properly.  A VM that needs to be consolidated will show a warning in the Configuration Issues alert on its' summary tab.  The consolidation process (new to vSphere 5) is actually quite simple.  Right click the VM, Snapshot->Consolidate.

Install and Configure VMware Data Recovery
 
VMware data recovery is a solution that VMware provides to create backups of VMs without interrupting their use or services they are providing. Data recovery is built on the VMware vStorage API for Data Protection and fully integrated with vCenter Server  Data Recovery is two fold, meaning you are provided with a virtual appliance as well as a client plug-in to manage it.  Backups can be stored on any virtual disk supported by vSphere.  All backed up VMs are stored on a deduplicated store.  VDR also supports Volume Shadow Copy Services (VSS) which provide application aware quiescing from within the Windows operating system.  In short this is the process that VDR takes to backup a VM.
  1.  A snapshot of the VM is taken.
  2. VDR leverages CBT or change block tracking to determine changes since its last backup.
  3. VDR copies the changes to its deduplicated store and applies the changes to its full backup to always have a current full backup available.

There are a few notable features and limitations that apply to VDR

  • Since ESX 3.5 did not support CBT, backups of VMs running on 3.5 or running hardware version 4 will take longer.
  • Swap files of VMs are not backed up.  Pagefile.sys files in windows and swap partitions inside Linux guests are not backed up.
  • Each instance of vCenter can support up to 10 Data Recovery Backup appliances
  • Each data recovery backup appliance can support/protect up to 100 VMs.
  • Data recovery is designed to support stores up to 1 TB in size.  You can have a bigger store, but performance of the deduplication may be impacted.
  • Each DR appliance is limited to only 2 stores.
  • If using NFS or CIFS, you are imposed to a limit o 500 GB.
  • Only 8 VMs can be backed up simultaneously by VDR
  • The store performs an integrity check which verifies and maintains data integrity.  This should be done during a maintenance window that the user defines.  This is designed to happen once a week.  This can also be started manually.  During a manual check, backups and restores are not allowed.  VDR maintains a record of its integrity check, thus if it is interrupted, it can pick up where it left off.
  • The store performs a recatalog operation to ensure that the catalog of restore points is consistent with the contents of the dedup store.  This operation runs automatically when it detects an inconsistency between the catalog and the dedup store.  No operations are allowed during this operation.
  • The store runs a reclaim operation which reclaims space on the dedup store.  Usually this is a result of retention policies being enforced and backups being removed.  Backups are not allowed during this operation, however restores are.  This operation runs on a daily basis during the maintenance window.

System Requirements for VDR

  • Requires vCenter Server and the vSphere Client
  • VMS to be backed up and the backup appliance must both be running on hosts running ESX(i) 4.0 or later.
  • To get all features, the host running the backup appliance needs to be connected to vCenter otherwise you wont get features such as automated backups.
  • When using vDR with vCenter servers in linked mode, log into the vCenter which the vDR appliance is associated.
  • May want to add 'dummy disks' to the vDR appliance in order to add a SCSI controller, otherwise all targeted VM disks might not be able to be hot added and will be backed up over the network.
  • Deduplication stores must be have at least 10 GB of free space.  This is used for indexing and restore point processing.  Initial setup recommends providing store space equal to the amount of used VM disk space.
  • Backup appliance connects to vCenter using ports 80 and 443
  • Backup appliance connects to ESX using ports 902
  • Data recovery plugin and FLR client connect to the backup appliance over port 22024
  • VDR completes operations using a vCenter login, so that login must have the appropriate permissions assigned to it.

Installing the Client Plug-in

  1. Either insert the Data Recovery installation Cd or download the plugin itself.
  2. Click 'Data Recovery Client Plug-In'
  3. Follow the prompts to install
  4. Select Plugins->Manage Plugins from the vSphere Client and make sure the Data Recovery Plug-In is enabled..

Installing the Backup Appliance

  1. Select File-> Deploy OVF Template.  When asked select Deploy From File.
  2. Select the correct OVF.
  3. Select a location for the appliance and rename it if you would like.
  4. Select the host or cluster where it is to be deployed.  Select a datastore where you want to store it.
  5. Select a disk format and a time zone.
  6. DONE.

Configuring the Backup Appliance

  • Default credentials are root and vmw@re
  • Configure a Static IP by using the 'Configure Network' option on the console.  Can also be done by browsing to its address through a web browser.
  • Adding a new hard disk.  (recommenced to use SCSI 1:0 to allow more hot add connections).
  • Extending a disk – Simply change the size in vCenter, the appliance should detect it and extend the disk, if not, reboot.
  • To gain access to configurable functions use the 'VMware Data Recovery' icon under the Solutions and Applications view in vCenter.  The getting started wizard should start which allows you to
    • Specify credentials to connect to vCenter
    • Specify your backup destinations.
      • To rescan for new drives select 'Refresh'
      • To format a disk to use a backup target select 'Format'
      • To attach a disk that already contains data select 'Mount'
      • To attach to a CIFS share select 'Add Network Share' and provide credentials.
Create a backup job with VMware Date Recovery
 
Creating a Backup Job
  1. Click the Backup tab and select New.  This will launch the backup wizard.
  2. Either accept the suggested name or enter a new one.
  3. Select the VMs you would like to be part of this job.  You can select one or more of the following
    • Datacenter
    • Resource Pool
    • Folder
    • Host
    • Individual VMs
    • Keep in mind, that when you select a top level hierarchy object, such as a folder, any new VMs that are placed in the folder will become part of the job, subsequently any VMs removed from the folder will not be backed up.  Same with VMs and disks.  Any new disks added to a VM will be backed up, and any removed – well, obviously not 🙂
  4. Select a destination.
  5. Either accept the default times or create a new backup window for this job.  By default jobs run at night on Monday through Friday and any time on the weekend.  VDR will attempt to back each VM up once a day.  If the backup time extends outside of the backup window, the backup stops and will restart again when the backup window opens.  Any VMs missed during a backup window are given priority during the next.
  6. Either accept the default retention policy or create a new one.  NOTE: If the store is more than 80% full, the retention policy is run each day, otherwise, it's run once a week.
  7. DONE!

A few other notables regarding backups

  • Backup Now – forces the appliance to run the backup job regardless of the backup window.  If a VM inside the job has been backed up within the last 24 hours, it will not be backed up during a Backup Now operation if you select Out of Date Sources.  You need to select All Sources if you want to back these VMs up as well.
  • Suspend Backups – Temporarily suspends the backup from starting any new backups.
  • Mark Restore points for removal or locking – you can override the retention policy and mark a restore point to be either kept or removed.  Any  marked for removed will not be removed until the next integrity or reclaim operation.

Perform a test and live full/file-level restore with VMware Data Recovery

Performing a full restore of VMs
  1. Select Restore from the Restore tab  This will start the Restore Wizard.
  2. Select a source (VM or VMs).
    • Can be VMs as well as individual disks
    • If multiple restore points are selected for one VM, vDR will only restore the latest restore point.
  3. Select a destination
    • The datastore and virtual disk node to which the files will be restored
    • Whether the configuration is restored
    • Whether the NIC should be connected
    • Power state of the restored VM.
    • Can specify alternate credentials to perform the restore with.
  4. DONE.

Performing a test restore (Restore Rehearsal)

  1. Right click a VM and select 'Restore Rehearsal from Last Backup'
  2. For the most part the default settings are fine, you can chose to override them all though.
  3. Select a destination.
  4. After restore is finished, a new VM with Rehearsal appended to its name is created.  Default is the same destination of the original VM.  All NICS are disconnected.

Performing a File Level Restore

  1. Install the FLR client inside the VM
  2. Enter in the IP address or name of the VDR appliance
  3. Select the virtual disk that you want to restore from.
  4. Click 'Mount'
  5. Click 'Browse'
  6. This will open and explorer window, browse to the files you need and copy them.
  7. When done, click 'Unmount All'.

The Linux options are very similar, but in a command line fashion.

Determine appropriate backup solution for a given vSphere implementation

Again, depends on your environment.  VDR might not be the solution if you are running many virtual machines as it can only backup 8 concurrently and you may not be able to get them all completed by the time the maintenance window ends.  As well, it's limited to the storage and dedupe stores it supports.  It can only have 2 dedupe stores for a max of 2TB total, so if you have very large VMs again this might not be the solution for you.  Also, this is not application aware, so applications such as SQL may be better off with their own backups.  This is however, still better than running the traditional type client backups from within VMs!
 

Leave a Reply

Your email address will not be published. Required fields are marked *