Home arrow Tools arrow NetBackup Management arrow NBU Trick #3 - Got an Itch?
May 03 2003
NBU Trick #3 - Got an Itch? Print E-mail
Written by Paul Winkeler   
Friday, 02 May 2003
Invariably NetBackup administrators freshly gloating over a few weeks' worth of successful NetBackup runs find themselves wondering why they are suddenly seeing jobs failing with error code 96 even though there are plenty of empty volumes available. Closer investigation shows that the empty volumes are not in the volume pool required by the failed jobs.
NetBackup will pull volumes from the scratch pool when the pool it is looking for is empty, but it will not pull tapes from other pools. The nail in the coffin, however, is that NetBackup will also not return empty volumes back to the scratch pool. That step is up to the administrator. Here is how to automate what some feel should be an integral part of NetBackup to begin with.
With the NBU module package comes a sample script called scratch.pl. It calls upon the NBU::Media class to return a list of all Media objects (read: volumes) know to the master server after which it iterates over the list to find all the empty volumes. Using an XML configuration file it looks for an element called itchy and uses its contents to decide which empty volumes may safely be returned to the scratch pool. Here is a typical itchy element:
  <itchy>
    <pool name="NetBackup">
      <density code="11"/>
      <density code="14"/>
    </pool>
    <pool name="MAXpool">
      <density code="11"/>
      <density code="14"/>
    </pool>
    <pool name="SAP_Production">
      <density code="14"/>
    </pool>
  </itchy>
This basically states that empty volumes from the NetBackup and MAXpool pools maybe returned to the scratch pool, but only if they are of density types 11 (dlt) or 14 (hcart2). Empty SAP_Production pool volumes are only "scratched" if they are of density hcart2.
The NBU based Perl code to do this, leaving out the section that deals with reading in the XML configuration file, looks like this:
# Find the name of the scratch pool and quit if there isn't one
my $scratch = NBU::Pool->scratch;
die "No scratch pool defined\n" unless (defined($scratch));

# Gather all the volumes about us
NBU::Media->populate(1);
my $tc = 0;
my $sc = 0;
for my $m (NBU::Media->list) {
  next if ($m->cleaningTape);  # Skip cleaning tapes, count all others
  $tc += 1;
  # Skip tapes still in use as wel as NetBackup (catalog) tapes  
  next if ($m->allocated);
  next if ($m->netbackup);

  # Every other tape is fair game, assuming it meets the itchy requirements
  next if (defined($m->pool) && !exists($itchy{$m->type.":".$m->pool->name}));

  $sc += 1;
  if ($opts{'n'}) {
    print "Could scratch ".$m->id." from ".$m->pool->name."\n";
  }
  else {
    # Setting a volume's pool to a new value will automagically cause the
    # appropriate NetBackup command to be executed!
    $m->pool($scratch);
  }
}
printf("Scratched $sc volumes (%.2f%%)\n", ($sc * 100) / $tc);
If you need help customizing this to your environment, This e-mail address is being protected from spam bots, you need JavaScript enabled to view it .
Last Updated ( Monday, 27 August 2007 )
 
< Prev