cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted

Delete multiple tapes from NetBackup Media Database and Relabel multiple tapes

Hello All, I know it's a not big issue but would like to know if you guys have any easy option for my two things.

1. We recently destroyed approx 1000 tapes and i am looking out for an option to delete them all at once from NetBackup Media Database.

2. We have also received approx 200 (images expired) tapes from other site. I want to relabel them all at once. Is there any option to do it all together?

Tags (1)
1 Solution

Accepted Solutions
Highlighted
Accepted Solution!

Re: Delete multiple tapes from NetBackup Media Database and Relabel multiple tapes

You do not indicate your operating system, but on my solaris master I have an easy script that does this:

1. scan the scratch pool - create file scratch.inventory

(I manually add tapes to the library)

2. inventory the library - see new tapes!

3. create file scratch.inventory.new

4. for each tape in scratch.inventory.new - check to see if it is in the original scratch.inventory

if so - skip - already labelled

if not - label it! This will automatically re-label any new tapes added.

This may be a solution to your problem!

NetBackup 8.1.2 on Solaris 11, writing to DataDomain 9800 6.0.2.50
duplicating via SLP to LTO5 in SL8500 via ACSLS

View solution in original post

Tags (2)
5 Replies
Highlighted

Re: Delete multiple tapes from NetBackup Media Database and Relabel multiple tapes

You can bulk select unassigned tapes in the GUI and delete.

To relabel tapes, they need to be loaded into a drive to overwrite the old label.

In the same way as it is impossible to manually replace the external labels all at once, it is just as impossible to overwrite the internal labels all at once.
Highlighted

Re: Delete multiple tapes from NetBackup Media Database and Relabel multiple tapes

thanks for the quick reply Marianne!

Looks like there is no such option for both things. I'll go with the normal path.

Congrats for the VIP!

Highlighted
Accepted Solution!

Re: Delete multiple tapes from NetBackup Media Database and Relabel multiple tapes

You do not indicate your operating system, but on my solaris master I have an easy script that does this:

1. scan the scratch pool - create file scratch.inventory

(I manually add tapes to the library)

2. inventory the library - see new tapes!

3. create file scratch.inventory.new

4. for each tape in scratch.inventory.new - check to see if it is in the original scratch.inventory

if so - skip - already labelled

if not - label it! This will automatically re-label any new tapes added.

This may be a solution to your problem!

NetBackup 8.1.2 on Solaris 11, writing to DataDomain 9800 6.0.2.50
duplicating via SLP to LTO5 in SL8500 via ACSLS

View solution in original post

Tags (2)
Highlighted

Re: Delete multiple tapes from NetBackup Media Database and Relabel multiple tapes

Sweet! Possible to share the script. We too have master and media on Solaris platform.

Re: Delete multiple tapes from NetBackup Media Database and Relabel multiple tapes

Please review and test this before running on YOUR system, we are not responsible for typo and inadvertent destruction!

so we run the first script which does the bpimage cleanup, nbdelete and deassignempty - to send the tapes to scratch., then we call our labelscratch script

## run image clean up command
## this find expired images and releases them
## this can take 30 minutes to complete!
/usr/openv/netbackup/bin/admincmd/bpimage -cleanup -allclients
sleep 2400
## run deassign images commands
## this finds tapes with expired images and reassigns them
## to the scratch pool
/usr/openv/netbackup/bin/admincmd/nbdelete -allvolumes -force
sleep 600
/usr/openv/netbackup/bin/admincmd/bpexpdate -deassignempty -force
sleep 600
### added relabel scripts to release data from data domains 2/4/2013 drm
/var/adm/scripts/labelscratch.sh 

 

We have multiple robots, so our script does multiple robots: You will need to update to match your robot number and names!

# cat /var/adm/scripts/labelscratch.sh
#!/usr/bin/ksh
#
# labelscratch.sh
# This program will list the tapes currently in the
# ${POOL} pool for each VTL library. We will then compare the list
# to the list created the last time this program was run.
# If the tape is new to the list it will be labeled.
# Once the labels are done we will delete the job IDs so they
# don't show up in the java console.
#
# Note: run from crontab @ 0300

#trap "echo bye bye" 0

FILEHOME=/opt/netbackup-labels
FILELIST=${FILEHOME}/scratch_pool_list-
MEDIASERVER=mediaserver to run label command on
PRIORITY=86168     # set weird priority to use to find and remove jobs once complete!
DEBUG="set -x"
DEBUG=""
POOL=scratch_pool

verifyoldfile()
{
${DEBUG}
# $1 must be the robot name
# if the file is not there, create an empty file. All tapes will be labeled...
if [ ! -f ${FILELIST}${1} ]
then
echo Warning: ${FILELIST}${1} is missing
/usr/bin/touch ${FILELIST}${1}
fi
return 0
}

generatenewfile ()
{
${DEBUG}
# $1 must be the robot name
# Populate the listing of tapes currently in the ${POOL} pool.
/usr/bin/rm -f ${FILELIST}${1}.new
if [ $1 = "robot1" ]
then
ROBOT=1
elif [ $1 = "robot2" ]
then
ROBOT=2
elif [ $1 = "robot3" ]
then
ROBOT=3
else
echo Bad robot number
return -1
fi

/usr/bin/touch ${FILELIST}${1}.start
/usr/openv/volmgr/bin/vmquery -pn ${POOL} -b | \
grep "TLD ${ROBOT}" | awk '{print $1}' > ${FILELIST}${1}.new

LINES=`wc ${FILELIST}${1}.new | awk '{print $1}' `
if [ $LINES -lt 1 ]
then
return 1 # no files to process
fi
return 0
}

replaceoldfile ()
{
${DEBUG}
# $1 must be the robot name.
# Save the current list of tapes to use next time as the already labeled list.
/usr/bin/rm -f ${FILELIST}${1}
/usr/bin/mv -f ${FILELIST}${1}.new ${FILELIST}${1}
if [ $? != 0 ]
then
return 1
fi
return 0
}

do_tape_loop()
{
# $1 must be the robot name
# Read the current list of tapes in the ${POOL} pool.
# If the tape was not in the list from last time we will label the tape
# Allow up to 20 label jobs to run in the background.
${DEBUG}
typeset -i x
x=0

for TAPE in `cat ${FILELIST}${1}.new`
do
grep $TAPE ${FILELIST}${1} >/dev/null 2>&1
RETURN=$?
if [ $RETURN -eq 1 ] #return of 0 indicates tape was in the pool last time run.
then
#echo Found a tape to label: $TAPE
x=${x}+1
/usr/openv/netbackup/bin/admincmd/bplabel -m ${TAPE} -d hcart3 \
-p ${POOL} -host ${MEDIASERVER} -o -priority ${PRIORITY} &

if [ $x -eq 20 ] # this number limits the background jobs
then
# time to wait for jobs to finish
NOTDONE=true
while [ $NOTDONE = "true" ]
do
JOBSLEFT=`jobs |wc | awk '{print $1}'`
if [ $JOBSLEFT -lt 4 ] #wait for most but not all
#jobs to finish
then
NOTDONE=false
fi
sleep 5
done
x=0
fi
fi
# Go back to the top of the for TAPE in loop
done
return 0

}

verifydir()
{
# Make sure our file directory exists
if [ ! -d $FILEHOME ]
then
echo Make a new Directory $FILEHOME
mkdir -p $FILEHOME
fi
return 0
}

cleanupjobs ()
{
#Since we know the unique priority for the label jobs, we can search
#for them and the delete their jobs IDs.


# time to wait for all jobs to finish
NOTDONE=true
while [ $NOTDONE = "true" ]
do
JOBSLEFT=`jobs |wc | awk '{print $1}'`
if [ $JOBSLEFT -lt 1 ] #wait for all jobs to finish
then
NOTDONE=false
fi
sleep 25
done

JOBNUM=false

for JOBNUM in `/usr/openv/netbackup/bin/admincmd/bpdbjobs -report -most_columns \
| grep ,${PRIORITY}, | grep ,8,3,0, | awk -F, '{print $1}' `
do
/usr/openv/netbackup/bin/admincmd/bpdbjobs -delete $JOBNUM >/dev/null 2>&1
done
return 0

}
#
# The Main program Loop
#


# We must have a $1 specifying which robot to work with.
# If we have a $2 it should be the pool name to work with
if [ x$1 = "xrobot1" ]
then
DD=robot1
elif [ x$1 = "xrobot2" ]
then
DD=robot2
elif [ x$1 = "xrobot3" ]
then
DD=robot3
else
echo ERROR: invalid Robot Name
exit 2
fi


if [ x$2 != "x" ]
then
POOL="$2"
FILELIST=${FILEHOME}/${POOL}_list-
/usr/openv/volmgr/bin/vmpool -listall | grep ${POOL} >/dev/null 2>&1
if [ $? != 0 ]
then
echo No such pool: ${POOL} found, exiting
exit 2
fi
fi

#
verifydir

# The continue(s) allow one set of labels to fail but still look at
# the other robot.

verifyoldfile $DD
if [ $? -ne 0 ]
then
continue
fi

generatenewfile $DD
if [ $? -ne 0 ]
then
continue
fi

do_tape_loop $DD
if [ $? -ne 0 ]
then
continue
fi

replaceoldfile $DD
if [ $? -ne 0 ]
then
continue
fi

/usr/bin/touch ${FILELIST}${1}.end
cleanupjobs
exit 0

NetBackup 8.1.2 on Solaris 11, writing to DataDomain 9800 6.0.2.50
duplicating via SLP to LTO5 in SL8500 via ACSLS
Tags (2)