Forum Discussion

RLeon's avatar
RLeon
Level 6
13 years ago

Open file backups, VSS snapshots and bpstart_notify scripts

Hi all,

This query is mainly for Windows, but may possibly apply to *nix platforms.

If a drive (say drive E:\), is to be VSS snapshotted and backed up, is this snapshot created BEFORE OR AFTER the bpstart_notify.bat script is run?
This is important because I may want to use bpstart_notify.bat to stop all I/Os to some opened files on E:\ before the snapshot should be taken.

Here is an example (which is really just my presumptions):
A custom program not supported by Netbackup, and has no VSS writer, is deployed on a Windows host.
It reads/writes some files on E:\ and never releases the file locks unless the program itself is shut down.

A script is created that does 2 things:
1.
Gracefully shuts down the program.
This is so that the file locks on E:\ are gone, and that the drive can be fully quiesced and snapshotted.
2.
After the shutdown (step 1. above), count 15 seconds and start the program again.
This means VSS is given a generous 15 seconds to take a snapshot of E:\
NOTE: This script has to be a non-blocking script. (IMPORTANT)

A line is placed in bpstart_notify.bat to call the script.

When the backup job starts, the following happens in strict order:
1. bpstart_notify.bat calls the script.
2. The script shuts down the program, which releases the file locks on E:\
2a. Since the script is a non-blocking script, Netbackup doesn't wait for it to finish.
3. The script at this point is still running a 15 seconds countdown, but AT THE SAME TIME, VSS takes a snapshot of the entire E:\, which should be successful seeing that no files are opened/locked.
4. The script completes its 15 seconds countdown and restarts the program.
5. Netbackup can take however long it wants to backup the snapshot. 1 hour? 2 hours? no problem! What's important is that the program is running and the backup doesn't interfere with it.

The above is what I presume how bpstart_notify.bat works in this situation.
So is this correct?
What I worry most is: What if the Windows VSS snapshot is taken BEFORE bpstart_notify.bat is run?
That would mean the snapshot would fail because there are still open/locked files on E:\.
If that happens, then the script that shuts down the program would be pointless because a failed snapshot attempt would already have happened before the file locks are released.


Thanks!

RLeon

  • If you wanted to disable VSS being used at all then yes you would have to set nothing to be used in the Master Servers host properties - having said that even if you did that it would still use it if you were backing up the Shadow Copy Components as it has to!

    Unless someone else comes up with a better idea then I think you will be a sad NetBackup Admin!

    Of course you could use a little trick ....

    Two policies created - the one you really want plus one that backups up a text file on its C drive

    The main one has schedules but no open windows so never runs on its own

    The new text file one has a bpstart_notify.textpolicyname.bat that stops you processes and then calls your backup using the bpbackup command (no need to use  a -w, just let it fire it off), wait for a period of time to let the snapshot complete and then put run your final processes.

    Note quite sure how you will get the timing perfect for all of this - what if your main job is in a queue waiting to start?

    Perhaps you could have its own bpstart_notify.mainpolicyname.bat pipe to a text file for each stream and the first one keep checking for when stream 2 appears (which is when the snapshot will have completed)?

    An entry such as:

    @echo number %stream_number% >> "c:\program files\veritas\netbackup\bin\bpstart.log"
     @echo count %stream_count% >> "c:\program files\veritas\netbackup\bin\bpstart.log"
     @echo pid %stream_pid% >> "c:\program files\veritas\netbackup\bin\bpstart.log"
     @echo ============================================== >> "c:\program files\veritas\netbackup\bin\bpstart.log"

    Would create a text file that looks like this:

    number 1

    count 3

    pid 1844

    ==============================================

    number 2

    count 3

    pid 6148

    ==============================================

    A bit of a workaround I know but should work

    Sorry it is not great - maybe someone else will have a "neater" way of doing it