Hi
You will also see this when you have decommissioned a media server. Tapes belonging to the media server don't tend to be returned to the SCRATCH pool. This when you get a lot of tapes with DBBACKUP status when you run available_media. The available_media script when it doesn't know what to do with a tape gives it a DBBACKUP status.
This should fix that and other similar stuff. 1. First generate a list of suspect tapes. First column is the mediaIDs. 2. Run this script - it checks to see if their a images on each media and spews out a very simple output. Patience is required it may take a will to run
------------------------------------------------------------------------ #!/bin/ksh # Author Jim McDonald , Sydney Aust # usage : script name followed by a file that has one column with media IDs to check
# output goes to /tmp/med-in-images and genrates rows of # media_id FRAG client_name # media_id IMAG client_name # media_id no entity was found # sorted by media_id # "no entity was found" = no images on that tape
TMP_FILE=/tmp/med-in-images > $TMP_FILE let CNT=0 for MED in $(cat $1 | awk '{ print $1 }'); do let CNT=CNT+1 echo $CNT , $MED # let you know its doing some work bpimmedia -mediaid $MED 2>&1 | nawk -v media=$MED '
$1 == "FRAG" { printf "%s FRAG %s \n",media,$10} $1 == "IMAG" { printf "%s IMAG %s \n",media,$2} /found/ { printf "%s %s\n",media,$0}
' >> $TMP_FILE done ------------------------------------------------------------------------------------------------------------ 3. You now have a file that list what is on media, incuded those that have nothing.
4. Create a list of files that you want to fix, Run grep "no entity was found" /tmp/med-in-images > to_deassign 5. Run this script to ------------------------------------------------------------------------------------------------------------
#!/bin/ksh # Author Jim McDonald , Sydney Aust # this generates lines like : # vmquery -deassignbyid AZ0070 3 # input : a file with one column of media IDs METHOD="vmquery -deassignbyid"
for MEDIA in $(cat $1 | awk '{ print $1 }'); do vmquery -m $MEDIA 2>&1 | sed s/0x//g | tr -d ")" | tr -d "(" | \ nawk -v how="$METHOD" ' /media ID:/ { printf"\n%s %s ",how,$3}
/volume pool:/ { printf"%s ",$4} /status:/ { printf"%s",$2 } ' done --------------------------------------------------------------------------------------------------------------
METHOD can be edited to include sudo if required
This generates outout for each media.....eg vmquery -deassignbyid Z00471 38 0 vmquery -deassignbyid CV1700 1 1 vmquery -deassignbyid CV1905 1 1 vmquery -deassignbyid CV0901 25 0
from their it simple to deassign all the media i.e your SCRATCH pool should automagically grow
Jim
_______________________________________________
Veritas-bu maillist - Veritas-bu AT mailman.eng.auburn DOT edu
http://mailman.eng.auburn.edu/mailman/listinfo/veritas-bu
|