Most applications that run on Windows these days are VSS aware, sometimes however you run across an older server type application that is not. Combine that with snapshot-based backups and you could wind up with some issues if you ever need to recover from a backup. Before we talk about Veeam, we first need to talk about the VMware side and how to
VMware has built-in pre and post scripting for use with snapshots to counteract this problem. Setting them up, however, is a completely manual process and will be custom for each application. Let’s take a look at what needs setup and how to do it.
Before we start looking at the VMware side of things we need to first figure out what command will stop and which command will start the program in question. For this example, I am working on a server that runs a CACHE database. CACHE is not VSS aware so without this script, we are crash consistent at best. The commands to stop and start the database are as follows:
D:IntersystemsCachebincss.exe STOP cache D:IntersystemsCachebincss.exe START cache
So how do we use these each time a snapshot is taken? The answer is VMware Tools, which allows us to add these commands to a script that is called each time before and after a snapshot operation. We need to navigate to where VMware Tools is installed and then create a directory called “backupScripts.d”, then inside of that we can create our scripts.
Inside of this folder, we can have multiple scripts, this makes it easy to keep track of what your all doing because you can put each application’s commands in its own script file. It should also be noted that they are executed in alphabetical order, so if you need them to run in a certain order make sure to use names that are preceded by a letter or number to keep them in order.
Now, let’s take a look at the actual script:
There are 4 sections to the script, the first is a bunch of if statements that direct the flow depending on if the script was called before or after the snapshot. The next three sections are for the different times the script is called. One for “Freeze” which is your “Pre-snapshot” area, one for “FreezeFail” for when a snapshot cannot be completed, and one for “Thaw” or after a snapshot was taken.
Inside of each area I have this script writing to a log file (just for testing… you don’t need this), and the command that needs to be ran before and after the snapshot.
Save your scripts and now let’s take a look at the Veeam side.
Veeam has its own quiesce tools and by default does not use the VMware quiesce tool, but in order to get the script to work, we need to use VMware’s tool. To enable this open the properties of your backup job and open up the “Advanced Settings” button. Inside of that dialog, we need to go to the Advanced Tab and select the “Enable VMware Tools Quiescence” checkbox.
Now after you exit the settings wizard you can run your backup job again and you will see that the script will stop, then start your application giving you an application-consistent backup.
It should also be noted that because this will now actually stop your application (in this case a database), the service it provides will be OFFLINE for a brief period while the snapshot is completed. This is normally only a second or so, but if you include stop and start time it could be as much as a minute depending on your application. As a best practice, you will want to only run this type of backup during hours where the service is not in use.