cancel
Showing results for 
Search instead for 
Did you mean: 

bpimagelist scripting

acioffarelli
Level 4

Hello, i need to check if one ore more backup images, written in a text file, have been duplicated from a media server to another. Some jobs were interrupted and i need to extract the images to be duplicated again. So i'm thinking about cycling the source file (the one with all the backup images that need to be duplicated) and run for every row, basically every backupid) the bpimagelist command. If no image is found then write the row (backupid) in a new file.

I'm thinking about a similar script:

#!/bin/sh

#Some variables...
FILE=/tmp/recupero_step10b3/test_recupero.txt
app_media_target=<mediaservername>
path_img_to_dupl=/tmp/recupero_step10b3

cat $FILE|while read line; do

/usr/openv/netbackup/bin/admincmd/bpimagelist -server $app_media_target -backupid $line

retVal=$?
echo $retVal >> ${path_img_to_dupl}/retVal.txt

if [ $retVal -ne 0 ]; then
echo "Image found: $line"
echo $line >> ${path_img_to_dupl}/lista_immagini_da_RECUPERARE.txt
fi
done

The problem is that this domain has several media servers, and the return code of the bpimagelist is ALWAYS 0. If i check the bpimagelist again the source media server from which i'm duplicating the image, the output is shown and the command exits succesfully. If i check the bpimagelist against the target media server, the one receiving the images, the output is blank and the return code still 0.

How can i update the script to extract the desired list?

Thank you!

7 REPLIES 7

quebek
Moderator
Moderator
   VIP    Certified

hey

well for this maybe bpverify -PD -cn x

would be better approach ???

Hi @quebek i'll try as you mentioned, maybe using also the -dp option to verify only the duplication target disk pool. Can you please explain -PD option? I've found -p or -pb in the command reference but no -PD.

https://www.veritas.com/support/en_US/doc/15263389-142519608-0/v14668047-142519608

 

Thanks

quebek
Moderator
Moderator
   VIP    Certified

hey

my bad I took this switch from the top of my head...

use -pb 

If -p or -pb is specified, bpverify previews the set of backups that meet the selection criteria. It displays the backup IDs, but does not perform the verification.

StefanosM
Level 6
Partner    VIP    Accredited Certified

well, I had a similar problem today.
If I want a smile way to check if a backup has duplicated or not I use the following (filters and parameters depend on the case)

bpimagelist -d 05/30/2023 -e 06/02/2023 |grep IMAGE |awk '{print $6","$21","$28","$19}' |awk -F"," '{if ($2 == 1) print $0}'

So if column 21 is 1 the output backupids are not duplicated. If you change the second awk to "awk -F"," '{if ($2 == 2)" it will print all backups that have two copies.
$6 is the backupID
$21 is the number of copies
$28 is the primary copy
$19 is the backup size.

In your script, I would change the way you check the command. Instead of $? I would use wc -l.

retVal=`usr/openv/netbackup/bin/admincmd/bpimagelist -server $app_media_target -backupid $line |wc -l`


 

Thank you for your suggestion. I just need to determine if a list of backup images, written in a file, are stored or not in a specific media server or diskpool. The domain has several media and i'm duplicating images from one of them to another before decommissioning the source one. I've already executed the duplication but it was cancelled by the sysadmin so i need to check if there are, i know from the java console that several of them were not duplicated, images that still need to be duplicated. I'll build a new source file and re-run the duplication task.

HI @acioffarelli 

You could also use the bpimmedia command for each disk pool (bpimmedia -stype PureDIsk -dp <diskpool>). From the source extract the list of images that need to be duplicated. From the target, check the list that have been. When they match job done (or if they don't match you know which images still need duplicating). 

Cheers
David

jnardello
Moderator
Moderator
   VIP    Certified

Don't forget that bpimagelist has a -server option since you're talking about intra-domain duplications - it's a really easy way to see what lives on a given Media Server.

Example check if a particular image lives on a specific Media Server:

bpimagelist -backupid blah_12345 -server mymediaserver > /dev/null
if [ $? -eq 0 ];then echo found
else
echo not found
fi

Good luck !