Hot backup Snapshot script
This appendix provides a script for performing effortless hot backups of guests at the datastore level. Guests can be grouped into datastores based on their Snapshot or SnapMirror backup policies, allowing multiple recovery point objectives to be met with little effort. Critical application server guests can have Snapshot copies automatically created based on a different schedule than second-tier applications, or test and development guests. The script even maintains multiple versions of snapshots.
The script shown in Example A-11 provides managed and consistent backups of guests in a VMware Virtual Infrastructure 3 environment using N series Snapshot technology. It is provided as an example that can easily be modified to meet the needs of an environment.
Backing up guests with this script completes the following processes:
Quiesces all the guests on a given datastore
Takes a crash-consistent N series Snapshot copy
Applies the redo logs and restores the virtual disk files to a read/write state
Example A-1 Hot backup Snapshot script
#!/bin/sh
#
# Example code which takes a Snapshot of all guests using the VMware
# vmware-cmd facility. It will maintain and cycle the last 3 Snapshot copies.
#
# This sample code is provided AS IS, with no support or warranties of any
# kind, including but not limited to warranties of merchantability or
# fitness of any kind, expressed or implied.
#
#
# --------------------------------------------------------------------------
PATH=$PATH:/bin:/usr/bin
 
# Step 1 Enumerate all guests on an individual VMware ESX Server, and put each
# guest in hot backup mode.
for i in `vmware-cmd -l`
do
vmware-cmd $i createsnapshot backup Nseries true false
done
# Step 2 Rotate N series Snapshot copies and delete oldest, create new,
# maintaining 3.
ssh <Nseries> snap delete <esx_data_vol> vmsnap.3
ssh <Nseries> snap rename <esx_data_vol> vmsnap.2 vmsnap.3
ssh <Nseries> snap rename <esx_data_vol> vmsnap.1 vmsnap.2
ssh <Nseries> snap create <esx_data_vol> vmsnap.1
# Step 3 Bring all guests out of hot backup mode,
for i in `vmware-cmd -l`
do
vmware-cmd $i removesnapshots
done
 

1 Original script provided by Vaughn Stewart, NetApp 2007
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.157.54