cancel
Showing results for 
Search instead for 
Did you mean: 

Expiring tapes.

smith_jones
Level 6

Hello All,

Can somebody please suggest how to expire multiple tapes at once. I am tired of expiring them one by one from commandline, when required.

 

Thanks.

1 ACCEPTED SOLUTION

Accepted Solutions

Will_Restore
Level 6

A simple script

  • for /f %%i in (c:\temp\medialist) do bpexpdate -d 0 -m %%i

Test it and make sure it works as expected, then append -force to the script to eliminate "do you really want to do this?" prompt.

Hope your next thread is not "I accidentally expired a bunch of tapes..." surprise

View solution in original post

13 REPLIES 13

manatee
Level 6

hi jones,

don't have NBU GUI console? much easier there.

cbsi_nbu_team
Level 3

I would do a simple script. Lets say you have a list of medias to expire in a file /tmp/foo

# for mid in `cat /tmp/foo`; do  echo working on $mid; bpexpdate -m $mid -recalculate -ret 0 -force; done

Disclaimer: the above is just an example, don't copy and paste other ppl's script without understanding fully what it does.

 

smith_jones
Level 6

Hi rino19ny,

where can we expire tapes from GUI?

I do it from CLI in windows.

 

Hi cbsi nbu team,

Say there are these tapes to be expired -

M001 M002 M003 M004 M005 

then how to do it at once.

I normally do it as -     bpexpdate -m M001 -d 0 -force

So can you please suggest the script according to it.

Genericus
Moderator
Moderator
   VIP   

Generally you should have a reason for the expiry - are you seeking how to manually run a clean to remove expired tapes? That is one issue.

If you are needing to expire tapes before they are scheduled to expire, that is a whole other issue - why? Do you need to modify your retentions?

If you have a group of tapes based on a specific value - like policy/schedule or retention or backup type, etc. There are options with the bpimagelist and bpexpdate that allow you to run simple scripts to expire the tapes. Generally it requires a two step process - determine the media ID, then bpexpdate that media.

PLEASE PLEASE PLASE - measure twice and cut once. Please verify these tapes do not have valued data, because once they are expired, it is arduous to recover.

 

Here are some sample logic loops you can run in unix

This uses date start and end ranges (-d and -e) client (-client) as well as schedule (-sl) - I updated the retention of copy 2 to retention 23, and recalculated the expiration date.

for i in `bpimagelist -idonly -d '01/01/2013' -e '03/13/2015' -client CLIENTNAME -sl SCHEDULENAME | cut -d " " -f10`
do
echo "Changing Backup ID: "$i at `date +%Y%m%d.%H%M`
 /usr/openv/netbackup/bin/admincmd/bpexpdate -recalculate -backupid $i -copy 2 -ret 23 -force
done
 

If you want to set a date, use /usr/openv/netbackup/bin/admincmd/bpexpdate -d "08/26/2026 00:00" -backupid $i -copy 2 -force

It won't let you set a date in the past, but you can set it for a few minutes from now, and then run the clean up afterwards.

 

NetBackup 10.2.0.1 on Flex 5360, duplicating via SLP to Access 3350, duplicating via SLP to LTO8 in SL8500 via ACSLS

Will_Restore
Level 6

Manually expiring tapes should be a rarity.  Image retention should meet business requirements.

 

smith_jones
Level 6

Hi,

All the tapes have same retention level, same schedule type and so on. The only thing I can use is Media ID. 

So I can set the date to past and then run image cleanup but how to do it for multiple media? I am not much clear from above inputs. I am windows user.

Also isn't there any way like i created a text file mentioned all the media ids in that and run some command like bpexpdate and that's it.

smith_jones
Level 6

Hi All,

Any resolution?

Will_Restore
Level 6

A simple script

  • for /f %%i in (c:\temp\medialist) do bpexpdate -d 0 -m %%i

Test it and make sure it works as expected, then append -force to the script to eliminate "do you really want to do this?" prompt.

Hope your next thread is not "I accidentally expired a bunch of tapes..." surprise

smith_jones
Level 6

Hi Will,

Yes that is why I did not proceed. smiley 

I need some understanding here.

Say there are these tapes to be expired -

M001 M002 M003 M004 M005 

 

Then ho this is gonna work? That is what is this script doing? steps.

 

Thanks.

Will_Restore
Level 6

create a file c:\temp\medialist

which contents are

M001

M002

M003

M004

M005 

then run the script

for /f %%i in (c:\temp\medialist) do bpexpdate -d 0 -m %%i

 

smith_jones
Level 6

Hi,

Need  more clarity.  

Where I have to run this command -  for /f %%i in (c:\temp\medialist) do bpexpdate -d 0 -m %%i ? As to run the command bpexpdate I think I should be at C:\Program Files\Veritas\NetBackup\bin\admincmd     right?

Can you guide me stepwise.

 

Thanks.

Will_Restore
Level 6

Yes

 

smith_jones
Level 6

Thanks. I read to understand the for /f loop command and understood how it is working on tokens and delimits.

Then I tested the command for bpexpdate and it worked.

Thanks alot.