Discussions related to exporting backups to tape and backing up directly to tape.
Post Reply
NMP
Novice
Posts: 4
Liked: never
Joined: Sep 24, 2015 1:31 pm
Full Name: Noor
Contact:

backup to tape , how to remove source jobs

Post by NMP »

Hi,
As Veeam cannot take direct backup to tapes. it has to be disk backup first. so when the source job complete, backup to tape can be taken.

my query is simple, due to disk space limitation, once disk to tape job is complete. I want to remove source jobs automatically in order to save disk space for the next backup. such situation may arise when we don't want to consume much disk space. as our daily, weekly, monthly and yearly go to disk.

from support they said, it is not possible. but it is possible to use PowerShell script to remove source jobs automatically once D2T is complete. I am looking for that script.
veremin
Product Manager
Posts: 20415
Liked: 2302 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: backup to tape , how to remove source jobs

Post by veremin »

Are you using backup to tape or file to tape job? In the latter case, take a look at this script. Thanks.
NMP
Novice
Posts: 4
Liked: never
Joined: Sep 24, 2015 1:31 pm
Full Name: Noor
Contact:

Re: backup to tape , how to remove source jobs

Post by NMP »

hi,

yes it is backup to tape job. Tape will store latest backup chain from disk.
veremin
Product Manager
Posts: 20415
Liked: 2302 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: backup to tape , how to remove source jobs

Post by veremin »

Then, it's just a matter of removing unnecessary files in a given directory, using Remove-Item cmdlet. Additional checks whether the job has finished successfully would not harm, though.

Code: Select all

If ((Get-VBRTapeJob -Name "Name of your Job").lastresult -eq "Success") }
Thanks.
Ioannis.T
Enthusiast
Posts: 32
Liked: 2 times
Joined: Dec 14, 2017 1:49 pm
Full Name: Ioannis Tsitsiklis
Contact:

[MERGED] Backup to tape and delete the files from repository

Post by Ioannis.T »

Hello,

I want ot achieve a simple thing.

1. Backup to disk repository VM1
2. Copy/Backup the disk repository backup to the tape library only VM1 backup files
3. Delete/remove the backup from the disk repository after successful step 2.
So far I could not find how to do that.
Ideas?

Thanks
Ioannis

PS.
I found a similar post from ~1year back but there was no posted solution, that is why I created a new one.
veremin
Product Manager
Posts: 20415
Liked: 2302 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: backup to tape , how to remove source jobs

Post by veremin »

Your topic has been merged into existing discussion. Kindly, take a look at the solution provided above. Thanks.
Ioannis.T
Enthusiast
Posts: 32
Liked: 2 times
Joined: Dec 14, 2017 1:49 pm
Full Name: Ioannis Tsitsiklis
Contact:

Re: backup to tape , how to remove source jobs

Post by Ioannis.T »

Hi Eremin,

Although that would do the trick and remove the files, that would mark the backup inside Veeam in an error state since Veeam is not aware of any deletion.
I am looking into something similar to catlett's solution on the other post, but I do not think to mess with the database of my backup software is good.
Ioannis.T
Enthusiast
Posts: 32
Liked: 2 times
Joined: Dec 14, 2017 1:49 pm
Full Name: Ioannis Tsitsiklis
Contact:

Re: backup to tape , how to remove source jobs

Post by Ioannis.T »

Hey,
back again. So I wrote a Powershell script (the below). executing by hand through PS, or right-click and run with PS, runs ok.
When I added it as a script to run at the end of the tape job, the job status reports that the script runs successfully, but I do not see any results.
Am I missing something?
Any help is appreciated.

Code: Select all

Add-PSSnapin -Name VeeamPSSnapIn -ErrorAction SilentlyContinue
if ((Get-VBRTapeJob -Name "TestB2T-2").lastresult -eq "Success") {Get-VBRBackup -Name "TestB2D-2" | Remove-VBRBackup -FromDisk | Out-File -Append -FilePath "D:\VeeamScripts\Testb2T-2.txt"}
Thank you
Ioannis
Ioannis.T
Enthusiast
Posts: 32
Liked: 2 times
Joined: Dec 14, 2017 1:49 pm
Full Name: Ioannis Tsitsiklis
Contact:

Re: backup to tape , how to remove source jobs

Post by Ioannis.T »

I updated the script with a "-Confirm" but the same thing happens.
Manually it all goes well. When running at the end of the job nothing happens

Code: Select all

Add-PSSnapin -Name VeeamPSSnapIn -ErrorAction SilentlyContinue
if ((Get-VBRTapeJob -Name "TestB2T-2").lastresult -eq "Success") {Get-VBRBackup -Name "TestB2D-2" | Remove-VBRBackup -FromDisk -Confirm:$false | Out-File -Append -FilePath "D:\VeeamScripts\Testb2T-2.txt"}
veremin
Product Manager
Posts: 20415
Liked: 2302 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: backup to tape , how to remove source jobs

Post by veremin »

Then, it seems that service account (under which Veeam services are executed) does not have required permissions on the location where backup data is stored. Thanks.
Ioannis.T
Enthusiast
Posts: 32
Liked: 2 times
Joined: Dec 14, 2017 1:49 pm
Full Name: Ioannis Tsitsiklis
Contact:

Re: backup to tape , how to remove source jobs

Post by Ioannis.T »

Hi Eremin,

The account is local admin and I confirmed that has full read-write permissions to that folder.
I added a get-date to that powershell to check if it runs.
From what I could gather the powershell script runs fine, since the output of the get-date command is saved every time. The command that removes the backup though does not seem to run properly.
There is something weird going on with the powershell commands.

Thanks
Ioannis.T
Enthusiast
Posts: 32
Liked: 2 times
Joined: Dec 14, 2017 1:49 pm
Full Name: Ioannis Tsitsiklis
Contact:

Re: backup to tape , how to remove source jobs

Post by Ioannis.T »

ok I found the issue

The option “Run a script after the job” does NOT actually runs a script after the job. It executes all the other parts of the job, including ejecting the tape and runs the script as the last task.
So, in my script I have

Code: Select all

if ((Get-VBRTapeJob -Name "TestB2T-2").lastresult -eq "Success")
which means, if the tape job completes successfully then delete the disk files.

The issue:
The tape job is running, and in fact, it is at 99%, at the moment that the script is being executed. So, I can never have a successful result and hence delete the files from the disk.
If I run the script without the “if” argument it works perfect.
The reason why when I ran it manually worked, was because the tape job was actually finished successfully.
The downside is that the files on disk will be deleted even if the tape job fails.

Any ideas on this?
Is there any record that states that the previous tasks were completed successfully?

Thanks
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 10 guests