-
- Novice
- Posts: 4
- Liked: 6 times
- Joined: Nov 19, 2015 9:38 am
- Full Name: Robert Rieß
- Contact:
Backup Copy Job - prevent execution
Hello,
we use Veeam B&R v8 together with a QNAP NAS. A RDX drive is connected to the QNAP by USB3. In Veeam I have configured the QNAP as linux host and two backup repositories on this host. One repository is the main backup location on the QNAP harddrives (/share/CACHEDEV1_DATA/Backup/). The second one is the destination for backup copies on the RDX drive (/share/external/DEV3301_1/). This one is configured for drive rotation.
The backup job runs from monday to saturday keeping 12 restore points. The backup copy job copies the data to RDX afterwards (copy method: direct). A post-run script of the copy job ejects the RDX cartridge. Everything works great until the RDX drive is not mounted (e.g. bank holiday). If the RDX drive is not mounted, Veeam creates the folder on its own (/share/external/DEV3301_1/) and starts copying data. This fails because the directory is created on the QNAPs ramdisk with 60MB left space. The ramdisk fills up and I have to restart the QNAP (or delete the data through ssh).
Now my question: How can I prevent the execution of the copy job if the drive is not mounted (the target folder does not exist)? It would be OK if the job fails an retries the execution at the next copy job interval. I tried already the pre-run script with exit code 1. Nevertheless Veeam executes the copy job with a warning and does not fail.
I hope someone can help me
we use Veeam B&R v8 together with a QNAP NAS. A RDX drive is connected to the QNAP by USB3. In Veeam I have configured the QNAP as linux host and two backup repositories on this host. One repository is the main backup location on the QNAP harddrives (/share/CACHEDEV1_DATA/Backup/). The second one is the destination for backup copies on the RDX drive (/share/external/DEV3301_1/). This one is configured for drive rotation.
The backup job runs from monday to saturday keeping 12 restore points. The backup copy job copies the data to RDX afterwards (copy method: direct). A post-run script of the copy job ejects the RDX cartridge. Everything works great until the RDX drive is not mounted (e.g. bank holiday). If the RDX drive is not mounted, Veeam creates the folder on its own (/share/external/DEV3301_1/) and starts copying data. This fails because the directory is created on the QNAPs ramdisk with 60MB left space. The ramdisk fills up and I have to restart the QNAP (or delete the data through ssh).
Now my question: How can I prevent the execution of the copy job if the drive is not mounted (the target folder does not exist)? It would be OK if the job fails an retries the execution at the next copy job interval. I tried already the pre-run script with exit code 1. Nevertheless Veeam executes the copy job with a warning and does not fail.
I hope someone can help me
-
- Product Manager
- Posts: 6551
- Liked: 765 times
- Joined: May 19, 2015 1:46 pm
- Contact:
Re: Backup Copy Job - prevent execution
Hi,
I'd place a while-loop inside your pre-run script with "folder does not exist" condition. Once the condition is not met (RDX is mounted) then your script should return zero. Also please make sure that you have "require succesful script execution" option enabled.
Thank you.
I'd place a while-loop inside your pre-run script with "folder does not exist" condition. Once the condition is not met (RDX is mounted) then your script should return zero. Also please make sure that you have "require succesful script execution" option enabled.
Thank you.
-
- Novice
- Posts: 4
- Liked: 6 times
- Joined: Nov 19, 2015 9:38 am
- Full Name: Robert Rieß
- Contact:
Re: Backup Copy Job - prevent execution
Hi,
thank You for Your answer! The "require succesful script execution" option is only available for backup jobs. It is not available for backup copy jobs.
The while-loop is an idea. But I think it will not work because the scripts have a maximum execution time. Even if the loop works, what happens at the next copy job interval? Will it abort? Will it execute twice once the directory exists?
thank You for Your answer! The "require succesful script execution" option is only available for backup jobs. It is not available for backup copy jobs.
The while-loop is an idea. But I think it will not work because the scripts have a maximum execution time. Even if the loop works, what happens at the next copy job interval? Will it abort? Will it execute twice once the directory exists?
-
- Product Manager
- Posts: 20405
- Liked: 2298 times
- Joined: Oct 26, 2012 3:28 pm
- Full Name: Vladimir Eremin
- Contact:
Re: Backup Copy Job - prevent execution
If the dates when a disk is not present are known in advance, would not it be easier to specify a script via Windows Task Scheduler that disables a backup copy job for the specified period and re-enables it afterwards?
-
- Novice
- Posts: 4
- Liked: 6 times
- Joined: Nov 19, 2015 9:38 am
- Full Name: Robert Rieß
- Contact:
Re: Backup Copy Job - prevent execution
Thank You!
The dates are not always known in advance. Sometimes someone forgets to replace the RDX cartridge. This shouldn't happen, but it does. If it happens it should not screw up the NAS. But I used Your idea.
I wrote a little script which executes after the main backup job. It disables the copy job if the directory does not exist and exits with a warning. Otherwise it enables the copy job. I think this should work.
I also tried this script as pre-run script for the copy job. But the copying starts before Veeam notices the disabled state of the job.
The dates are not always known in advance. Sometimes someone forgets to replace the RDX cartridge. This shouldn't happen, but it does. If it happens it should not screw up the NAS. But I used Your idea.
I wrote a little script which executes after the main backup job. It disables the copy job if the directory does not exist and exits with a warning. Otherwise it enables the copy job. I think this should work.
Code: Select all
Add-PSSnapin VeeamPSSnapin
New-SshSession -ComputerName NAS -Username ... -KeyFile "D:\Scripts\Veeam\id_rsa"
$Query = Invoke-SshCommand -ComputerName NAS -Command "mount | grep /dev/sdg1"
Remove-SshSession -RemoveAll
$CopyJob = Get-VBRJob -Name "Copy to RDX"
if ($Query) {
Write-Host "RDX drive ready. Enable copy job."
Enable-VBRJob -Job $CopyJob
} else {
Write-Host "RDX drive not ready! Disable copy job."
Disable-VBRJob -Job $CopyJob
exit 1
}
-
- Product Manager
- Posts: 20405
- Liked: 2298 times
- Joined: Oct 26, 2012 3:28 pm
- Full Name: Vladimir Eremin
- Contact:
Re: Backup Copy Job - prevent execution
Yep, your solution should work fine. The source backup job should run, then, check whether the given directory exists, and act in accordance either enabling or disabling the backup copy job. Thanks.
-
- Novice
- Posts: 4
- Liked: 6 times
- Joined: Nov 19, 2015 9:38 am
- Full Name: Robert Rieß
- Contact:
Re: Backup Copy Job - prevent execution
Hi,
Great!
Now I have also extended my script which ejects the RDX cartridge. It only ejects the cartridge if everything was OK and disables the copy job after ejecting.
This should also avoid the run of the copy job on sunday (the primary backup job doesn't run on sunday) and Veeam could reschedule the job if something wents wrong during copying.
I think this should cover nearly each possibility. (Only if somebody ejects the cartridge manually there is a small chance that the backup copy job runs onto the ramdisk.)
Perhaps somebody needs a similar script, so I post it here:
The disabling of the job in the first script should now be unnecessary. But it doesn't hurt.
(Everything would be much easier if there would be a possibility to prevent the execution of copy job by pre-run script. Feature request?)
Great!
Now I have also extended my script which ejects the RDX cartridge. It only ejects the cartridge if everything was OK and disables the copy job after ejecting.
This should also avoid the run of the copy job on sunday (the primary backup job doesn't run on sunday) and Veeam could reschedule the job if something wents wrong during copying.
I think this should cover nearly each possibility. (Only if somebody ejects the cartridge manually there is a small chance that the backup copy job runs onto the ramdisk.)
Perhaps somebody needs a similar script, so I post it here:
Code: Select all
Add-PSSnapin VeeamPSSnapin
$CopyJob = Get-VBRJob -Name "Copy to RDX"
$CopySession = $CopyJob.FindLastSession()
$CopyTasks = $CopySession.GetTaskSessions() | ? { $_.Status -ne "Success" }
if (! $CopyTasks) {
Start-Sleep -Seconds 10
New-SshSession -ComputerName NAS -Username ...-KeyFile "D:\Scripts\Veeam\id_rsa"
$Query = Invoke-SshCommand -ComputerName NAS -Command "/opt/bin/eject /dev/sdg1"
Remove-SshSession -RemoveAll
Write-Host "Copy job finished. Disable copy job."
Disable-VBRJob -Job $CopyJob
}
(Everything would be much easier if there would be a possibility to prevent the execution of copy job by pre-run script. Feature request?)
Who is online
Users browsing this forum: No registered users and 8 guests