Bacula-users

Re: [Bacula-users] Automatic Volume creation

2011-07-07 10:36:02
Subject: Re: [Bacula-users] Automatic Volume creation
From: Bob Hetzel <beh AT case DOT edu>
To: bacula-users AT lists.sourceforge DOT net
Date: Thu, 07 Jul 2011 10:33:06 -0400
>
> On 07/07/11 02:28, Robert.Mortimer wrote:
>>> >>
>>> >> Hi,
>>> >>
>>> >> I have Bacula running with an IBM TL3400. As the tapes are bar coded
>>> >> Bacula can read the library and add the tapes to it's catalogue. I can
>>> >> than move then to the backup pools. My issue is the tapes have not had a
>>> >> volume written to the front of the tape using the label command they
>>> >> fail to mount with the following bconsole status.
>>> >>
>>> >> Device "Drive-3" (/dev/nst2) open but no Bacula volume is currently
>>> >> mounted.
>>> >>    Device is BLOCKED waiting for mount of volume "CBP10020",
>>> >>       Pool:        snapshot-pool
>>> >>       Media type:  LTO-3
>>> >>    Slot 11 is loaded in drive 2.
>>> >>    Total Bytes Read=0 Blocks Read=0 Bytes/block=0
>>> >>    Positioned at File=0 Block=0
>>> >>
>>> >>
>>> >> Tape CBP10020 is in /dev/nst2 but is blank. How do I get Bacula to
>>> >> automatically initialise the tape and write the volume label. My storage
>>> >> definition is as follows:-
>>> >>
>>> >> Device {
>>> >>  Name = Drive-3                      #
>>> >>  Drive Index = 2
>>> >>  Media Type = LTO-3
>>> >>  Archive Device = /dev/nst2
>>> >>  AutomaticMount = yes;               # when device opened, read it
>>> >>  AlwaysOpen = yes;
>>> >>  RemovableMedia = yes;
>>> >>  RandomAccess = no;
>>> >>  AutoChanger = yes
>>> >>  Alert Command = "sh -c 'smartctl -H -l error %c'"
>>> >> Maximum Spool Size = 100GB
>>> >> # Spool Size = 40GB
>>> >> Maximum Job Spool Size = 40GB
>>> >> Spool Directory = /backup/hosts/SPOOL
>>> >> }
>>> >>
>>> >>
>>> >> I sort of assumed that AutomaticMount would do it. I am reluctant to use
>>> >> LabelMedia because I am not sure it will use that label on the bar code
>>> >> rather than issuing a new one. Can anyone confirm that behaviour of
>>> >> LabelMedia when used with a bar coded auto-changer?
>>> >>
>> >
>> > I have tried "LabelMedia = yes" and I still have the same issue
>> > There must be a fix for this but at the moment I am a loss I
>> > Suspect there is a fix but I just don't know the magic word
>> >
>> >
>>> >> Robert Mortimer
>
>
> Hi Robert...
>
> With a tape library, you will want to use the "label barcodes" command.
> Bacula will ask you what pool you want to put them into and will ask if it is
> OK to go ahead and label them..
>
> Remember though, that Bacula will label the tapes the same as their barcodes
> and not some other name that you may prefer.
>
> --
> Bill Arlofski
> Reverse Polarity, LLC
> http://www.revpol.com/
>

Folks,

Put a "Label Media = yes" line in your device config of your bacula-sd.conf 
file.  Do NOT set a LabeLFormat value for tapes if you're using barcodes. 
The only thing you need to do then is add each volume to the database 
individually, then if the tape is truly blank bacula will label it properly 
based on the barcode.  If it was written with some other backup system you 
may have to label it manually or write EOF's to it first.  Bacula's 
auto-label stuff works well but last I checked wasn't well documented.

To add volumes to the database you can use the menus but that's a pain if 
you do more than one or two.  I've got a script to add multiple volumes to 
the database.  I believe I got at least part of it from here so I claim no 
ownership.

Enjoy,

    Bob

#!/bin/bash
progname=`basename $0`

echo="/bin/echo -e"
bconsole="/opt/bacula/bin/bconsole"
poolname="Scratch"

volbase="LTO"
volsuffix="L4"

if [ $# -ne 2 ]
then
   echo "Usage: $progname volstart volend"
   echo " For example: "
   echo "   $progname 401 402"
   vol1="${volbase}401${volsuffix}"
   vol2="${volbase}402${volsuffix}"
   echo "   will create volumes $vol1 and $vol2"
   echo "   Note: You should then issue an 'update slots' in bconsole to 
tell bacula where these tapes are."
   exit 1
fi


volstart=$1
volend=$2

#$volname=LTO463L4
#$echo add pool=$poolname \\n0\\n$volname\\n0\\nyes\\n |bconsole

for ((i=$volstart; i<=$volend; i++))
do
   volname="${volbase}${i}${volsuffix}"
   $echo "add pool=${poolname}\\n0\\n${volname}\\n0\\nyes\\n" |$bconsole
done




------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security 
threats, fraudulent activity, and more. Splunk takes this data and makes 
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2d-c2
_______________________________________________
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>