To enable quiescing for Linux VM snapshots, you must create custom quiescing scripts to run pre-freeze and post-thaw commands.
Prerequisites
Prerequisites for custom quiescing scripts on Linux VMs are as follows:
- The scripts have to be created in the /etc/vmware-tools/backupScripts.d directory on Linux VMs. (This directory does not exist by default, so you must create it.)
- The directory can contain one script or multiple scripts that are executed in sequence. The filenames of the scripts affect the execution order (for example, 10-webapp.sh, then 20-database.sh).
- Each script must be able to handle freeze, freezeFail and thaw arguments passed by VMware Tools during the different phases.
- VMware Tools version 10.2 or higher must be installed on the VMs.
Example Script
This is an example script written to support quiescing for a Linux VM running a PostgreSQL database.
#!/bin/sh if [[ $1 == "freeze" ]] then # set log directory log="/var/log/vpostgres_backup.log" # set and log start date today=`date +%Y\/%m\/%d\ %H:%M:%S` echo "${today}: Start of creation consistent state" >> ${log} # execute freeze command. # This command can be modified as per the database command cmd="echo \"SELECT pg_start_backup('${today}', true);\" | sudo -i -u postgres psql >> ${log} 2>&1" eval ${cmd} # set and log end date today=`date +%Y\/%m\/%d\ %H:%M:%S` echo "${today}: Finished freeze script" >> ${log} elif [[ $1 == "thaw" ]] then echo "This section is executed when the Snapshot is removed" log="/var/log/vpostgres_backup.log" # set and log start date today=`date +%Y\/%m\/%d\ %H:%M:%S` echo "${today}: Release of backup" >> ${log} # execute release command cmd="echo \"SELECT pg_stop_backup();\" | sudo -i -u postgres psql >> ${log} 2>&1" eval ${cmd} # set and log end date today=`date +%Y\/%m\/%d\ %H:%M:%S` echo "${today}: Finished thaw script" >> ${log} elif [[ $1 == "freezeFail" ]] then echo "This section is executed when the Quiescing Fails." else echo "No argument was provided" fi