Discussions specific to tape backups
Post Reply
NMP
Lurker
Posts: 2
Liked: never
Joined: Sep 24, 2015 1:31 pm
Full Name: Noor
Contact:

backup to tape , how to remove source jobs

Post by NMP » Jul 26, 2016 9:27 am

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.

v.Eremin
Veeam Software
Posts: 15157
Liked: 1141 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: backup to tape , how to remove source jobs

Post by v.Eremin » Jul 26, 2016 1:18 pm

Are you using backup to tape or file to tape job? In the latter case, take a look at this script. Thanks.

NMP
Lurker
Posts: 2
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 » Jul 27, 2016 5:55 am

hi,

yes it is backup to tape job. Tape will store latest backup chain from disk.

v.Eremin
Veeam Software
Posts: 15157
Liked: 1141 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: backup to tape , how to remove source jobs

Post by v.Eremin » Jul 27, 2016 11:48 am

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
Influencer
Posts: 18
Liked: never
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 » Dec 21, 2017 3:01 pm

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.

v.Eremin
Veeam Software
Posts: 15157
Liked: 1141 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: backup to tape , how to remove source jobs

Post by v.Eremin » Dec 21, 2017 5:50 pm

Your topic has been merged into existing discussion. Kindly, take a look at the solution provided above. Thanks.

Ioannis.T
Influencer
Posts: 18
Liked: never
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 » Dec 28, 2017 12:17 pm

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
Influencer
Posts: 18
Liked: never
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 » Dec 28, 2017 3:16 pm

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
Influencer
Posts: 18
Liked: never
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 » Dec 28, 2017 3:57 pm

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"}

v.Eremin
Veeam Software
Posts: 15157
Liked: 1141 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: backup to tape , how to remove source jobs

Post by v.Eremin » Jan 04, 2018 3:17 pm

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
Influencer
Posts: 18
Liked: never
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 » Jan 04, 2018 7:40 pm

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
Influencer
Posts: 18
Liked: never
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 » Jan 04, 2018 9:42 pm

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], Google [Bot] and 4 guests