Logging manual tape changes

Everything about backing up to tape

Logging manual tape changes

Veeam Logoby pshute » Wed Apr 13, 2016 4:35 am

Is there a way to get Veeam to log which tape is in the drive at a particular time of day?

We have a single manual tape drive, and I want to check if people are changing the tape in between weekly backups. E.g. On Tuesday someone might put in the correct tape for the following Monday's backup, but someone, for some reason, manually ejects it and puts in a different one on Thursday. Is there any record kept of that change, and if not, is there a way to get it to make one?

If I run an inventory on the drive, it will display which tape is loaded, but it doesn't list that tape name in the job history. Even if it did, is there a way to schedule an inventory?
pshute
Expert
 
Posts: 118
Liked: 8 times
Joined: Mon Nov 23, 2015 10:56 pm
Full Name: Peter Shute

Re: Logging manual tape changes

Veeam Logoby PTide » Wed Apr 13, 2016 8:26 am

Hi,

You can use PowerShell cmdlets to check what tape is in the drive:

Code: Select all
Get-VBRTapeMedium -Drive (Get-VBRTapeDrive -name "Name of your drive")


That will return you information about current tape. Is that what you need?

Thank you.
PTide
Veeam Software
 
Posts: 3022
Liked: 247 times
Joined: Tue May 19, 2015 1:46 pm

Re: Logging manual tape changes

Veeam Logoby pshute » Wed Apr 13, 2016 11:24 pm

Thanks, that will be very useful.

We only have one tape drive. Is it correct that we can omit the -name parameter?

Initially, the command returned no results. I suspect this was because Veeam thought the drive was empty because I just manually changed the tape this morning. It returned results after an inventory, so it looks like my script will have to do an inventory first. I can't get the inventory CmdLet to work. Is this correct:
Get-VBRTapeDrive|Start-VBRTapeInventory

That command seems to work fine after running an inventory from the GUI, IF there's a tape in it. But if it thinks the drive is empty, the command above crashes:
"Start-VBRTapeInventory : Cannot validate argument on parameter 'Medium'. The argument is null."

I tried this instead:
Get-VBRTapeLibrary|Start-VBRTapeInventory
But it doesn't do anything. It still thinks the drive is in the previous state (empty/loaded). What do I have to do to get it to do an inventory?

Also, when I read your response last night, there was a simpler command. Did you edit it?
pshute
Expert
 
Posts: 118
Liked: 8 times
Joined: Mon Nov 23, 2015 10:56 pm
Full Name: Peter Shute

Re: Logging manual tape changes

Veeam Logoby pshute » Thu Apr 14, 2016 3:33 am

pshute wrote:I tried this instead:
Get-VBRTapeLibrary|Start-VBRTapeInventory
But it doesn't do anything. It still thinks the drive is in the previous state (empty/loaded). What do I have to do to get it to do an inventory?


It seems that this command does work, but with a delay. It seems fairly quick when a tape has just been inserted, but takes over a minute when one has just been ejected (manually). (Timed at 95 seconds.)

How can the script tell when the inventory is finished?
pshute
Expert
 
Posts: 118
Liked: 8 times
Joined: Mon Nov 23, 2015 10:56 pm
Full Name: Peter Shute

Re: Logging manual tape changes

Veeam Logoby v.Eremin » Thu Apr 14, 2016 10:05 am

You can use -Wait switch, so that, script proceeds to the next line only when the previous command finishes:

Code: Select all
Start-VBRTapeInventory -Wait


Thanks.
v.Eremin
Veeam Software
 
Posts: 13295
Liked: 973 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

Re: Logging manual tape changes

Veeam Logoby pshute » Thu Apr 14, 2016 9:34 pm

Thanks, that does the job. Why does it take so long when the drive is empty?

And why does:
Get-VBRTapeDrive|Start-VBRTapeInventory
crash when the drive is empty?
pshute
Expert
 
Posts: 118
Liked: 8 times
Joined: Mon Nov 23, 2015 10:56 pm
Full Name: Peter Shute

Re: Logging manual tape changes

Veeam Logoby pshute » Thu Apr 14, 2016 9:59 pm

And is there a way to get the results into the Veeam history? I can email them somewhere, but it would be nice to have a record that can be examined in Veeam itself.
pshute
Expert
 
Posts: 118
Liked: 8 times
Joined: Mon Nov 23, 2015 10:56 pm
Full Name: Peter Shute

Re: Logging manual tape changes

Veeam Logoby v.Eremin » Fri Apr 15, 2016 7:56 am

crash when the drive is empty?

Can you initiate the same operation via GUI to limit the scope of potential suspects? With what particular error does it crash?

And is there a way to get the results into the Veeam history?

Could you elaborate on what results are meant here?

Thanks.
v.Eremin
Veeam Software
 
Posts: 13295
Liked: 973 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

Re: Logging manual tape changes

Veeam Logoby pshute » Sun Apr 17, 2016 9:21 pm

v.Eremin wrote:Can you initiate the same operation via GUI to limit the scope of potential suspects? With what particular error does it crash?


The command that crashes is:

Code: Select all
Get-VBRTapeDrive|Start-VBRTapeInventory
"Start-VBRTapeInventory : Cannot validate argument on parameter 'Medium'. The argument is null."


It will do that if it thinks the drive is empty.

I'm now using:

Code: Select all
Get-VBRTapeLibrary|Start-VBRTapeInventory


which works well. I'd like to know why the difference in behaviour.

Could you elaborate on what results are meant here?


The results I'm returning are the name of the tape in the drive, or "Drive empty". I would like to log that, somehow. The inventory command is automatically logged in the Veeam History, but not the name of the tape it found. I'd like to add that too, if possible.
pshute
Expert
 
Posts: 118
Liked: 8 times
Joined: Mon Nov 23, 2015 10:56 pm
Full Name: Peter Shute

Re: Logging manual tape changes

Veeam Logoby v.Eremin » Mon Apr 18, 2016 11:27 am

I'd like to know why the difference in behaviour.

It must be related to the different objects that are returned by each cmdlet. Get-VBRDrive returns a drive object, while Get-VBRTapeLibrary a library one.

The Start-VBRTapeInvetory works either with library or with tape object. Thus, it fails when you pass a drive object to it through a pipeline.

The results I'm returning are the name of the tape in the drive, or "Drive empty". I would like to log that, somehow.

If I'm not mistaken, after inventory a tape stays in drive. So, once inventory is finished, you can query a drive and check what medium is present there. This should be your cassette that has been just inventoried.

Thanks.
v.Eremin
Veeam Software
 
Posts: 13295
Liked: 973 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

Re: Logging manual tape changes

Veeam Logoby pshute » Wed May 04, 2016 11:50 pm

In case anyone else is trying the same thing, I've noticed that Get-VBRTapeLibrary|Start-VBRTapeInventory -Wait fails after I've manually ejected and then inserted a brand new tape (i.e. unnamed). I'm now testing for inventory failure, and retrying if necessary:
Code: Select all
$i=Get-VBRTapeLibrary|Start-VBRTapeInventory -Wait
if ($i.Result -eq "Failed") {$i=Get-VBRTapeLibrary|Start-VBRTapeInventory -Wait}
pshute
Expert
 
Posts: 118
Liked: 8 times
Joined: Mon Nov 23, 2015 10:56 pm
Full Name: Peter Shute

Re: Logging manual tape changes

Veeam Logoby v.Eremin » Thu May 05, 2016 9:34 am

I'm wondering whether it crashes with the "Cannot validate argument" error which then goes away once the operation is retried. Thanks.
v.Eremin
Veeam Software
 
Posts: 13295
Liked: 973 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin


Return to Tape



Who is online

Users browsing this forum: Yahoo [Bot] and 12 guests