PowerShell script exchange
Post Reply
Markus M.
Enthusiast
Posts: 29
Liked: 18 times
Joined: Dec 09, 2019 5:41 pm

Tape-Job: disable / enable finished Backup Jobs

Post by Markus M. »

Hi,

consider following situation:
A tape Job is processing a lengthy list of VBR Backups (virtualized file server backups running as Reverse-incremental). Because not using a GFS policy for weekly, monthly export to tape, the problem was that when running a tape-job and processing one of the file servers backups during this, it was sometimes "overhauled" by the next cycle of the backup-job and ended up in an indefinite loop inside the tape-job.
Solution is to have a pre- and post command in the tape-job and temporarily disable the processed backup jobs and re-enable them on the end of the tape-job.
These pre- and post commands running ok so far, with the disadvantage that all these backup jobs not being processed during the tape-job.
Because the amount of data grows continously, this processing time for the tape job increases and keeps backup-jobs disabled too long, which is unwanted.
Next idea was to have another script which evaluates the the progress of the tape-job and re-enables all the successfully processed backups (i.e. triggered via task scheduler)

All together, this is not an ideal solution, though.
All discussion to implement a solid GFS policy for this, instead ended w/o success so far.
However, if somebody knows how to get the progress inside the tape-job via PS, it might would help me finding a workaround for this.

Thanks,
Markus
HannesK
Product Manager
Posts: 14322
Liked: 2890 times
Joined: Sep 01, 2014 11:46 am
Full Name: Hannes Kasparick
Location: Austria
Contact:

Re: Tape-Job: disable / enable finished Backup Jobs

Post by HannesK »

Hello,
I'm not sure about the PowerShell question, but what's wrong with using the Prevent this job from being interrupted by source backup jobs option? I believe, that's what you try to achieve, right?

Best regards,
Hannes
Markus M.
Enthusiast
Posts: 29
Liked: 18 times
Joined: Dec 09, 2019 5:41 pm

Re: Tape-Job: disable / enable finished Backup Jobs

Post by Markus M. »

Hello Hannes,

you are right, that is exactly what I want to achieve.
But for some reason, this option did not work as expected. I discussed this (years ago) with Veeam support team: Case 03856771

The conclusion was:

Unfortunately, this is expected behavior, especially for per-vm backup chains. Please have a look at the note in the article below:
https://helpcenter.veeam.com/docs/backu ... l?ver=95u4

During backup to tape job with an option "Prevent this job from being interrupted by source backup jobs" tape job will lock backup files which are going to write to the tapes at the moment (If you are using per-vm backup chain the particular ".vbk" file for dedicated VM will be locked).
But if the during long backup to tape the source files were changed Tape job will catch up them and try to write to the tape modified backups also.
In your example, I'm assuming this is per-vm with revers incremental chain. For that reason, Veeam writes the new VBK every day.

How to setup such configuration that you want correctly:
- you need to split backup to tape job to the smaller jobs that they had time to write to the tape before source backups will start and enable GFS option:
https://helpcenter.veeam.com/docs/backu ... l?ver=95u4
With GFS option you won't need to create separate jobs like (monthly, weekly) and you will avoid having the same restore point to be written twice.


While GFS wasn't an option and splitting up into separate tape jobs either, I am stuck with the current pre and post commands.
While observing the choices I have in PS, I found the following so far:

Code: Select all

$test = Get-VBRTapeJob -Name "Monthly_Export"
Get-VBRSession -Job $test | where $_.State -eq "Working"

$test2 = Get-VBRSession -Job $test | where State -eq "Working" | select Log -ExpandProperty Log
$y = 0
$SessionCounter = $test2.Count

do 
   {
    write-host $test2[$y].Title
    $y += 1
   }
   until($y -gt ($SessionCounter-1))
which is not a solution yet but might be usable for it.
HannesK
Product Manager
Posts: 14322
Liked: 2890 times
Joined: Sep 01, 2014 11:46 am
Full Name: Hannes Kasparick
Location: Austria
Contact:

Re: Tape-Job: disable / enable finished Backup Jobs

Post by HannesK »

Hello,
sounds like a behavior that was changed some years ago... did you try it with V11a / latest version?

Best regards,
Hannes
Markus M.
Enthusiast
Posts: 29
Liked: 18 times
Joined: Dec 09, 2019 5:41 pm

Re: Tape-Job: disable / enable finished Backup Jobs

Post by Markus M. »

Hello Hannes,

no - I didn't - sounds like I should :-)
In the meantime I wrote some code to process this according to my initial question:

Code: Select all

$TapeJobName = Get-VBRTapeJob -Name "Monthly_Export"
$strTitleTrim= "Processing full backup of"

$TapeJobLog = Get-VBRSession -Job $TapeJobName | where State -eq "Working" | select Log -ExpandProperty Log
$TapeJobsSucceded = $TapeJobLog | where {($_.Status -EQ "Succeeded") -and ($_.Title -like "Processing full backup of*")}
$y = 0
$BackupJobName = $null
$BackupJobState = $null
$SessionCounter = $TapeJobsSucceded.Count

  do 
     {
      $BackupJobName =  ($TapeJobsSucceded[$y].Title).trimStart($strTitleTrim)
      $BackupJobState = get-vbrjob -Name $BackupJobName | select IsScheduleEnabled
     
       if($BackupJobState.IsScheduleEnabled -eq $False)
        {
         #write-host "VBR-Job $BackupJobName has property IsScheduleEnabled:"$BackupJobState.IsScheduleEnabled
         Enable-VBRJob -Job $BackupJobName
        }


      $y += 1
      $BackupJobState = $null
      $BackupJobName = $null
     }
     until($y -gt ($SessionCounter-1))
     

Running this code (triggered by a scheduled task) would certainly do the trick.
However, if you say there was a change in V11 (I've updated the 9.5U4 installation to 11a and didn't use V10) I am going to give this a try, first.
That would be of course far better.

Thanks,
Markus
Post Reply

Who is online

Users browsing this forum: No registered users and 14 guests