Bacula-users

Re: [Bacula-users] Make bacula reacycle and ask for several tapes in autochanger

2011-01-11 12:59:49
Subject: Re: [Bacula-users] Make bacula reacycle and ask for several tapes in autochanger
From: Juanra <amon.raj AT gmail DOT com>
To: bacula-users AT lists.sourceforge DOT net
Date: Tue, 11 Jan 2011 18:56:56 +0100


2011/1/11 Guy <guy AT britewhite DOT net>
On 11 Jan 2011, at 13:12, Juanra wrote:

> Hello all.
>
> I have an TS3100 autochanger and I use barcodes with bacula to label diferent tapes.
>
> The problem is when bacula starts a backup it only ask for one tape, I modify operator command to stimate size of backup but I want bacula to recycle all tapes that can be recycled.
>
> Any ideas
> ------------------------------------------------------------------------------
> Gaining the trust of online customers is vital for the success of any company
> that requires sensitive data to be transmitted over the Web.   Learn how to
> best implement a security strategy that keeps consumers' information secure
> and instills the confidence they need to proceed with transactions.
> http://p.sf.net/sfu/oracle-sfdevnl _______________________________________________
> Bacula-users mailing list
> Bacula-users AT lists.sourceforge DOT net
> https://lists.sourceforge.net/lists/listinfo/bacula-users


Hi,

Can you clarify this.. do you mean that you have two tape drives and it only ever uses one?

or that your backup is small enough to fit on one tape and it keeps recycling the same tape?

Can you provide some of your configuration data? eg pool data, Storage Configuration, What are your retention times set to?

Cheers,
---Guy

Our configuration is a lite confusing. We have a multichanger and I want make bacula ask for multiple tapes. Now bacula only recycle one tape when it is need and when it is full ask another tape, needing another operator intervention. I want to make bacula recycle all tapes,  keeping retention periods, and ask for all of these in one mount request. 

Below is part of my bacula-dir.conf with relevant information and the script that is launched in mail command:

# Definition of file storage device
Storage {
  Name = File
# Do not use "localhost" here
  Address = 172.26.7.201                # N.B. Use a fully qualified name here
  SDPort = 9103
  Password = "9S+AtfMwfjjxuGZA7LJbpXKqk0STWfT4mkYwBxUZOD7O"
  Device = FileStorage
  Media Type = LTO-3
  Maximum Concurrent Jobs = 20
}

Storage {
  Name = TS3100drv0
#  #Do not use "localhost" here
  Address =  172.26.7.201               # N.B. Use a fully qualified name here
  SDPort = 9103
  Password = "9S+AtfMwfjjxuGZA7LJbpXKqk0STWfT4mkYwBxUZOD7O"        # password for Storage daemon
  Device = TS3100drv0                 # must be same as Device in Storage daemon
  Media Type = LTO-3                  # must be same as MediaType in Storage daemon
  Autochanger = yes                   # enable for autochanger device
  Maximum Concurrent Jobs = 20
}

Messages {
  Name = Standard
#
  mailcommand = "/usr/bin/bsmtp -h 172.26.7.13 -f \"copias AT bacula.adimposp DOT eu\" -s \"Bacula: %t %e of %c %l\" %r"
#  operatorcommand = "/usr/bin/bsmtp -h 172.26.7.13 -f \"copias AT bacula.adimposp DOT eu\" -s \"Bacula: Atencion requerida para  %j\" %r"
#       mailcommand = "/bin/bash -c '(cat;baculadone -n)|/usr/sbin/bsmtp -h localhost -f \"Bacula Backup %d \<%copias AT bacula.adimposp DOT eu\>\" -s \"Bacula: %t %e of %c %l\" %r '"
operatorcommand = "bash -c \"(cat;/etc/bacula/scripts/asktapes.sh %t %n)| /usr/bin/bsmtp -h 172.26.7.13 -f 'copias AT bacula.adimposp DOT eu' -s 'Bacula: Atencion requerida para  %j' %r\" "
# operatorcommand = "/etc/bacula/scripts/asktapes.sh %t %n | /usr/bin/bsmtp -h 172.26.7.13 -f \"copias AT bacula.adimposp DOT eu\" -s \"Bacula: Atencion requerida para  %j\" %r"
  mail = adminbacula AT adimpo DOT eu = all, !skipped
  operator = adminbacula AT adimpo DOT eu = mount
  console = all, !skipped, !saved
 append = "/var/lib/bacula/log" = all, !skipped
}

Pool {
  Name = LTO
  Pool Type = Backup
  Recycle = yes                       # Bacula can automatically recycle Volumes
  AutoPrune = yes                     # Prune expired volumes
  Volume Retention = 15 days         # one year
  Volume Use Duration = 22 hours
  #Accept Any Volume = yes
  Recycle Oldest Volume = yes
  Recycle Pool = Scratch
  Scratch Pool = Scratch
  Cleaning Prefix = "CLN"
  Storage = TS3100drv0
}

# Default pool definition
Pool {
  Name = Default
  Pool Type = Backup
  Recycle = yes                       # Bacula can automatically recycle Volumes
  AutoPrune = yes                     # Prune expired volumes
  Volume Retention = 2 days         # one year
  Volume Use Duration = 22 hours
  #Accept Any Volume = yes
  Recycle Oldest Volume = yes
  #Maximum Volume Jobs = 4            #numero de maquinas a copiar. Para que se pasen los datos a cinta.
  Maximum Volumes = 5                 #Para limitar el tamano del disco.
  #Maximum Volume Bytes = 131941395333
  LabelFormat = "Vol"
  Storage = File
  ActionOnPurge=Truncate
  Next Pool = LTO
  #Recycle Pool = Scratch
  #Scratch Pool = Scratch
  #Cleaning Prefix = "CLN"
  #Label Format = "Full-${Year}-${Month:p/2/0/r}-${Day:p/2/0/r}-${Hour:p/2/0/r}:${Minute:p/2/0/r}"
}


# Default pool definition
Pool {
  Name = Anual
  Pool Type = Backup
  Recycle = yes                       # Bacula can automatically recycle Volumes
  AutoPrune = yes                     # Prune expired volumes
  Volume Retention = 56 days         # two months
  Volume Use Duration = 46 hours
  Recycle Oldest Volume = yes
  Recycle Pool = Scratch
  Scratch Pool = Scratch
  Cleaning Prefix = "CLN"
  Storage = TS3100drv0
  #Label Format = "Full-${Year}-${Month:p/2/0/r}-${Day:p/2/0/r}-${Hour:p/2/0/r}:${Minute:p/2/0/r}"
}

Schedule {
  Name = "WeeklyCycle"
  #Run = Full 1st sat at 23:05
  Run = Level=Full Pool=Anual SpoolData=yes 1st fri at 22:05
  Run = Full 2nd-4th sat at 22:05
  Run = Differential mon-thu at 22:05
  #Run = Incremental sun-fri at 22:05
}

Schedule {
  Name = "LiberWeeklyCycle"
  #Run = Full 1st sat at 23:05
  Run = Level=Full Pool=Anual SpoolData=yes 1st sat at 2:05
  Run = Full 2nd-4th sat at 2:05
  Run = Differential sun-fri at 2:05
  #Run = Incremental sun-fri at 2:05
}

Schedule {
  Name = "migrate-schedule"
  #Run = Full sun-sat at 23:10
  Run = mon-fri at 10:05
}
# Scratch pool definition
Pool {
  Name = Scratch
  Pool Type = Backup
}


JobDefs {
  Name = "DefaultJob"
  Type = Backup
  Level = Incremental
  Client = el5_32_build-fd
  FileSet = "Full Set"
  Schedule = "WeeklyCycle"
  #Incremental Pool = Default
  #Differential Pool = Default
  #Full Pool = LTO
  #Storage = TS3100drv0
  Messages = Standard
  Pool = Default
  Priority = 10
  Max Start Delay = 20h
  Max Run Sched Time = 14h
  #Max Start Delay = 4h
  Max Wait Time = 10h
  #SpoolData = no
  Prefer Mounted Volumes = yes
}


Job {
  Name = "BackupCatalog"
  JobDefs = "DefaultJob"
  Level = Full
  FileSet="Catalog"
  Schedule = "WeeklyCycleAfterBackup"
  # This creates an ASCII copy of the catalog
  # WARNING!!! Passing the password via the command line is insecure.
  # see comments in make_catalog_backup for details.
  # Arguments to make_catalog_backup are:
  #  make_catalog_backup <database-name> <user-name> <password> <host>
  RunBeforeJob = "/etc/bacula/scripts/make_catalog_backup bacula bacula"
  # This deletes the copy of the catalog
  #RunAfterJob  = "/etc/bacula/scripts/delete_catalog_backup;/etc/bacula/scripts/migration-markused.sh"
  RunAfterJob  = "/etc/bacula/scripts/migration-markused.sh"
  Write Bootstrap = "/var/lib/bacula/BackupCatalog.bsr"
  Priority = 21                   # run after main backup
}

#Trabajo para migrar el contenido del disco a cinta
Job {
  Name = "migrate-volume"
  Type = Copy
  Level = Full
  Schedule = "migrate-schedule"
  Client = el5_32_build-fd
  FileSet = "Full Set"
  Messages = Standard
  Pool = Default
  Maximum Concurrent Jobs = 4
  Priority = 22
  Max Start Delay = 16h
  Max Run Sched Time = 20h
  #Max Run Time =
  #Max Start Delay = 4h
  Max Wait Time = 14h
  #Selection Type = PoolUncopiedJobs
  Selection Type = Volume
  Selection Pattern = "Vol"
  # RunBeforeJob = "/etc/bacula/scripts/migration-markused.sh"
}

----------------------------------------------------------------------------------------------------
asktapes.sh

bconsole="/usr/bin/bconsole -s -c /etc/bacula/bconsole.conf"

tmpfile="/tmp/llistmedia.txt"

function bconsole_list_media() {
  $bconsole <<EOD_LISTMEDIA
list media
quit
EOD_LISTMEDIA
}

function bconsole_llist_media() {
  $bconsole <<EOD_LLISTMEDIA
llist media
quit
EOD_LLISTMEDIA
}

tam=`cat /var/lib/bacula/Volsize`

echo "----------------------------------------------------"
echo "Parameters: $@"
if [ "$1" = "Copy" ]; then
echo "---------------------------------------------------------------------------------------";
echo $1;
echo $2;
bconsole_llist_media > $tmpfile
#runpool=`cat $tmpfile | grep "mediaid: "$volID -B 2 | grep "Pool" | cut --delimiter=":" -f2`

s=`echo "(${tam//,/}/1000000000)" | bc`
echo "Se a realizar la copia de $tam Gigabytes"
numtapes=`echo "(${tam//,/}/300000000000)+1" | bc`
echo "Es necesario intoducir $numtapes cintas. Se puede introducir una nueva cinta o cualquiera de las siguientes:"
n=0
bconsole_list_media | while read mediatable;
do
   volume=`echo $mediatable | grep ^\|`
   wrds=`echo $volume | wc -w`
   if [ $wrds -ne "0" ]; then
     volID=`echo $volume | cut --delimiter="|" -f2`
     volname=`echo $volume | cut --delimiter="|" -f3`
     volstat=`echo $volume | cut --delimiter="|" -f4`
     voltam=`echo $volume | cut --delimiter="|" -f6`
     if [ $volID != "MediaId" ]; then
        volID=${volID//[[:space:]]}
        volname=${volname//[[:space:]]}
        volstat=${volstat//[[:space:]]}

        pool=`cat $tmpfile | grep "mediaid: "$volID -B 2 | grep "Pool" | cut --delimiter=":" -f2`
        #cat $tmpfile | grep "mediaid: "$volID -B 2
        pool=${pool//[[:space:]]}
        echo "Volume: $volume" >> /var/log/bacula/asktapes.log
        echo "volname: $volname"  >> /var/log/bacula/asktapes.log
        echo "volstat: $volstat"  >> /var/log/bacula/asktapes.log
        echo "pool: $pool"  >> /var/log/bacula/asktapes.log
        if [ "$volstat" = "Recycle" ]; then
           if  [ "$2" = "migrate-volume" ]; then
                if [ "$pool" = "LTO" ]; then
                        echo "$volname"
                fi
           else
                if [ "$pool" = "Anual" ]; then
                        echo "$volname"
                fi
           fi
        fi
        (( n += 1 ))
     fi
   fi
done
fi

------------------------------------------------------------------------------
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand 
malware threats, the impact they can have on your business, and how you 
can protect your company and customers by using code signing.
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
Bacula-users mailing list
Bacula-users AT lists.sourceforge DOT net
https://lists.sourceforge.net/lists/listinfo/bacula-users
<Prev in Thread] Current Thread [Next in Thread>