Bacula-users

Re: [Bacula-users] Please mount Volume "A0000003" or label a newone for...

2008-07-02 03:37:43
Subject: Re: [Bacula-users] Please mount Volume "A0000003" or label a newone for...
From: Arno Lehmann <al AT its-lehmann DOT de>
To: Bacula-users AT lists.sourceforge DOT net
Date: Wed, 02 Jul 2008 09:37:13 +0200
Hello,

02.07.2008 08:36, Javier Rodriguez wrote:
>   My OS is Ubuntu Hardy.
> The output of 'mt -f /dev/nst0 status' is BOT ONLINE IM_REP_EN.
> I increased the number of seconds for Wait_For_Drive() to 500.

You might find it more useful (at least I do) to try the check, say, 
30 times and sleep for 20 seconds. Gives a maximum wait time of ten 
minutes, but doesn't create new processes each second.

> I 've seen an extrange thing. Seeing the Wait_For_Drive() funtion. In 
> the next line:
> ...
> if mt -f $1 status 2>&1 | grep "${ready}"
> ...
> 
> $1 references to the autoloader, not the tape. The tape has to be 
> /dev/nst0.
> Is it a bug in the script or may be i'm too confused at this moment?

I believe you're confusing the parameters of the script with the ones 
to this function alone.

In the distributed version, wait_for_drive() is called with only one 
parameter, and that is the tape drive to check.

> Anyway i just to change this line to
> ...
> if mt -f $4 status 2>&1 | grep "${ready}"
> ...

I guess this will break if you ever want to check anything else than 
/dev/tape (which, for *my* kernel and mt, is the default to use when 
not supplying a parameter). $4 will be empty in wait_for_drive...

Arno

> Thanks a lot.
> 
> 
> 
> --- El *mar, 1/7/08, Brian Debelius /<bdebelius AT intelesyscorp DOT com>/* 
> escribió:
> 
>     De: Brian Debelius <bdebelius AT intelesyscorp DOT com>
>     Asunto: Re: [Bacula-users] Please mount Volume "A0000003" or label a
>     newone for...
>     Para: ungue79 AT yahoo DOT es
>     Fecha: martes, 1 julio, 2008 1:31
> 
>     I would do this.
> 
>     0.  What OS are you using?
>     1.  load a tape into the drive
>     2.  run `mt -f /dev/nst0 status`  What does this output?  Does it say 
>     ONLINE?  We need to know this to make sure the Wait_For_Drive() function 
>     is working correctly.
>     3.  Instead of sleep, I would increase the wait time in the 
>     Wait_For_Drive() function from 300 seconds to something higher.  My 
>     VXA-172 drive can take up to 20 minutes to load a tape. 
>      You may want to 
>     contact the manufacturer, and to determine the maximum load time for you 
>     drive.
> 
> 
> 
> 
>     Javier Rodriguez wrote:
>     > Hello.
>     >
>     > To increase the wait time, i dit it by editing the mtx-changer script 
>     > in section load:
>     >
>     > load)
>     >       debug "Doing mtx -f $ctl load $slot $drive"
>     >       ${MTX} -f $ctl load $slot $drive
>     >       rtn=$?
>     >       sleep 120
>     >       exit $rtn
>     >       ;;
>     > I think 120 seconds should be sufficient, isn't it?
>     >
>     > Here i show my mtx-changer script:
>     >
>     > #!/bin/sh
>     > #
>     > # Bacula interface to mtx autoloader
>     > #
>     > #  $Id: mtx-changer.in 6712 2008-04-01 10:27:46Z kerns $
>     > #
>     > #  If you set in your Device resource
>     > #
>     > #  Changer Command = "path-to-this-script/mtx-changer %c %o %S %a
>     %d"
>     > #    you will have the following input to this
>      script:
>     > #
>     > #  So Bacula will always call with all the following arguments, even 
>     > though
>     > #    in come cases, not all are used.
>     > #
>     > #  mtx-changer "changer-device" "command"
>     "slot" "archive-device" 
>     > "drive-index"
>     > #                  $1              $2       $3        $4               
> $5
>     > #
>     > #  for example:
>     > #
>     > #  mtx-changer /dev/sg0 load 1 /dev/nst0 0 (on a Linux system)
>     > #
>     > #  will request to load the first cartidge into drive 0, where
>     > #   the SCSI control channel is /dev/sg0, and the read/write device
>     > #   is /dev/nst0.
>     > #
>     > #  The commands are:
>     > #      Command            Function
>     > #      unload             unload a given slot
>     > #      load               load a given slot
>     > #      loaded             which slot is loaded?
>     > #      list               list Volume names (requires barcode
>      reader)
>     > #      slots              how many slots total?
>     > #
>     > #  Slots are numbered from 1 ...
>     > #  Drives are numbered from 0 ...
>     > #
>     > #
>     > #  If you need to an offline, refer to the drive as $4
>     > #    e.g.   mt -f $4 offline
>     > #
>     > #  Many changers need an offline after the unload. Also many
>     > #   changers need a sleep 60 after the mtx load.
>     > #
>     > #  N.B. If you change the script, take care to return either
>     > #   the mtx exit code or a 0. If the script exits with a non-zero
>     > #   exit code, Bacula will assume the request failed.
>     > #
>     >
>     > MTX=/usr/sbin/mtx
>     >
>     > # mt status output
>     > # SunOS     No Additional Sense
>     > # FreeBSD   Current Driver State: at rest.
>     > # Linux     ONLINE
>     > #  Note Debian has a different mt than the standard Linux version.
>     > #    When no tape is in the drive it waits 2
>      minutes.
>     > #    When a tape is in the drive, it prints user unfriendly output.
>     > #
>     >
>     > OS=`uname`
>     > case ${OS} in
>     >   SunOS)
>     >     ready="No Additional Sense"
>     >     ;;
>     >   FreeBSD)
>     >     ready="Current Driver State: at rest."
>     >     ;;
>     >   Linux)
>     >     if test -e /etc/debian_version ; then
>     >        ready="drive status"
>     >     else
>     >        ready="ONLINE"
>     >     fi
>     >   ;;
>     > esac
>     >
>     > #
>     > # log whats done
>     > #
>     > # to turn on logging, uncomment the following line
>     > touch /var/lib/bacula/mtx.log
>     > #
>     > dbgfile="/var/lib/bacula/mtx.log"
>     > debug() {
>     >     if test -f $dbgfile; then
>     >         echo "`date +\"%Y%m%d-%H:%M:%S\"` $*"
>     >> $dbgfile
>     >     fi
>     > }
>     >
>     >
>     > #
>     > # Create a temporary file
>     > #
>     > make_temp_file() {
>     >  
>      TMPFILE=`mktemp /var/lib/bacula/mtx.XXXXXXXXXX`
>     >   if test x${TMPFILE} = x; then
>     >      TMPFILE="/var/lib/bacula/mtx.$$"
>     >      if test -f ${TMPFILE}; then
>     >         echo "Temp file security problem on: ${TMPFILE}"
>     >         exit 1
>     >      fi
>     >   fi
>     > }
>     >
>     > #
>     > # The purpose of this function to wait a maximum
>     > #   time for the drive. It will
>     > #   return as soon as the drive is ready, or after
>     > #   waiting a maximum of 300 seconds.
>     > # Note, this is very system dependent, so if you are
>     > #   not running on Linux, you will probably need to
>     > #   re-write it, or at least change the grep target.
>     > #   We've attempted to get the appropriate OS grep targets
>     > #   in the code at the top of this script.
>     > #
>     > wait_for_drive() {
>     >   i=0
>     >   while [ $i -le 300 ]; do  # Wait max 300 seconds
>     >     if mt -f $1 status
>      2>&1 | grep "${ready}"
>     >/dev/null 2>&1; then
>     >       break
>     >     fi
>     >     debug "Device $1 - not ready, retrying..."
>     >     sleep 1
>     >     i=`expr $i + 1`
>     >   done
>     > }
>     > # check parameter count on commandline
>     > #
>     > check_parm_count() {
>     >     pCount=$1
>     >     pCountNeed=$2
>     >     if test $pCount -lt $pCountNeed; then
>     >         echo "usage: mtx-changer ctl-device command [slot 
>     > archive-device drive-index]"
>     >         echo "  Insufficient number of arguments given."
>     >         if test $pCount -lt 2; then
>     >             echo "  Mimimum usage is first two arguments ..."
>     >         else
>     >             echo "  Command expected $pCountNeed arguments"
>     >         fi
>     >         exit 1
>     >     fi
>     > }
>     >
>     > # Check for special cases where only 2 arguments are needed,
>     > #  all others are a minimum of
>      5
>     > #
>     > case $2 in
>     >     list)
>     >         check_parm_count $# 2
>     >         ;;
>     >     slots)
>     >         check_parm_count $# 2
>     >         ;;
>     >     *)
>     >         check_parm_count $# 5
>     >         ;;
>     > esac
>     >
>     >
>     > # Setup arguments
>     > ctl=$1
>     > cmd="$2"
>     > slot=$3
>     > device=$4
>     > drive=$5
>     >
>     > debug "Parms: $ctl $cmd $slot $device $drive"
>     > case $cmd in
>     >    unload)
>     >       debug "Doing mtx -f $ctl unload $slot $drive"
>     > #
>     > # enable the following line if you need to eject the cartridge
>     > #     mt -f $device offline
>     > #     sleep 10
>     >       ${MTX} -f $ctl unload $slot $drive
>     >       ;;
>     >
>     >    load)
>     >       debug "Doing mtx -f $ctl load $slot $drive"
>     >       ${MTX} -f $ctl load $slot $drive
>     >       rtn=$?
>     > #
>     > # Increase the sleep time if you have
>      a slow device
>     > # or remove the sleep and add the following:
>     >       sleep 120
>     > #      wait_for_drive $device
>     >       exit $rtn
>     >       ;;
>     >
>     >    list)
>     >       debug "Doing mtx -f $ctl -- to list volumes"
>     >       make_temp_file
>     > # Enable the following if you are using barcodes and need an inventory
>     > #     ${MTX} -f $ctl inventory
>     >       ${MTX} -f $ctl status >${TMPFILE}
>     >       rtn=$?
>     >       cat ${TMPFILE} | grep " Storage Element [0-9]*:.*Full" |
>     awk 
>     > "{print \$3 \$4}" | sed "s/Full
>     *\(:VolumeTag=\)*//"
>     > #
>     > # If you have a VXA PacketLoader and the above does not work, try
>     > #  turning it off and enabling the following line.
>     > #     cat ${TMPFILE} | grep " *Storage Element [0-9]*:.*Full" |
>     sed 
>     > "s/ Storage Element //" | sed "s/Full :VolumeTag=//"
>     > #
>     >       cat ${TMPFILE} | grep "^Data Transfer
>      Element [0-9]*:Full 
>     > (Storage Element [0-9]" | awk '{printf
>     "%s:%s\n",$7,$10}'
>     >       rm -f ${TMPFILE} >/dev/null 2>&1
>     >       exit $rtn
>     >       ;;
>     >
>     >    loaded)
>     >       debug "Doing mtx -f $ctl $drive -- to find what is loaded"
>     >       make_temp_file
>     >       ${MTX} -f $ctl status >${TMPFILE}
>     >       rtn=$?
>     >       cat ${TMPFILE} | grep "^Data Transfer Element $drive:Full"
>     | awk 
>     > "{print \$7}"
>     >       cat ${TMPFILE} | grep "^Data Transfer Element
>     $drive:Empty" | 
>     > awk "{print 0}"
>     >       rm -f ${TMPFILE} >/dev/null 2>&1
>     >       exit $rtn
>     >       ;;
>     >
>     >    slots)
>     >       debug "Doing mtx -f $ctl -- to get count of slots"
>     >       ${MTX} -f $ctl status | grep " *Storage Changer" | awk
>     "{print \$5}"
>     >       ;;
>     > esac
>     >
>     >
>     > My problems are becoming very usuals and
>      several days i've got to 
>     > operate manually.
>     > Thanks for your help.
>     >
>     >
>     > --- El *vie, 20/6/08, Gregg A. Discenza /<gdiscenza AT carana DOT 
> com>/* 
>     > escribió:
>     >
>     >     De: Gregg A. Discenza <gdiscenza AT carana DOT com>
>     >     Asunto: Re: [Bacula-users] Please mount Volume "A0000003" or
>     label
>     >     a newone for...
>     >     Para: Bacula-users AT lists.sourceforge DOT net
>     >     Fecha: viernes, 20 junio, 2008 2:01
>     >
>     >     
>     >     I saw this error every time I tried to use my newly installed
>     >     autoloader.
>     >      
>     >     The salient error is not "Please mount....." but instead
>     "Error:
>     >     block.c...."
>     >      
>     >     You need to increase the wait time between issuing a changer
>     >     command and bacula trying to mount the tape drive.
>     >      
>     >     HTH
>     >      
>     >     -Gregg
>     >
>     >        
>      -----Original Message-----
>     >         *From:* bacula-users-bounces AT lists.sourceforge DOT net
>     >         [mailto:bacula-users-bounces AT lists.sourceforge DOT net]*On 
> Behalf
>     >         Of *Javier Rodriguez
>     >         *Sent:* Friday, June 20, 2008 2:29 AM
>     >         *To:* drescherjm AT gmail DOT com; Bacula-users AT 
> lists.sourceforge DOT net
>     >         *Subject:* Re: [Bacula-users] Please mount Volume
>     "A0000003"
>     >         or label a newone for...
>     >
>     >         Mmmm. The problem came again, but now with another tape. Here
>     >         I dump the messages shown by bacula:
>     >
>     >         19-jun 22:00 servfich-dir JobId 53: Start Backup JobId 53,
>     >         Job=Backup_de_Trabajo_Diario.2008-06-19_22.00.39
>     >         19-jun 22:00 servfich-dir JobId 53: There are no more Jobs
>     >         associated with Volume "A0000004". Marking it purged.
>     >         19-jun 22:00 servfich-dir JobId 53: All records pruned
>      from
>     >         Volume "A0000004"; marking it "Purged"
>     >         19-jun 22:00 servfich-dir JobId 53: Recycled volume
>     "A0000004"
>     >         19-jun 22:00 servfich-sd JobId 53: 3307 Issuing autochanger
>     >         "unload slot 3, drive 0" command.
>     >         19-jun 22:05 servfich-sd JobId 53: 3995 Bad autochanger
>     >         "unload slot 3, drive 0": ERR=Child died from signal 15:
>     >         Termination
>     >         Results=Unloading drive 0 into Storage Element 3...done
>     >         Program killed by Bacula watchdog (timeout)
>     >         19-jun 22:05 servfich-dir JobId 53: Using Device
>     "Driver1"
>     >         19-jun 22:05 servfich-sd JobId 53: 3301 Issuing autochanger
>     >         "loaded? drive 0" command.
>     >         19-jun 22:05 servfich-sd JobId 53: 3302 Autochanger "loaded?
>     >         drive 0", result is Slot 3.
>     >         19-jun 22:05 servfich-sd JobId 53: 3307 Issuing
>      autochanger
>     >         "unload slot 3, drive 0" command.
>     >         19-jun 22:06 servfich-sd JobId 53: 3995 Bad autochanger
>     >         "unload slot 3, drive 0": ERR=Child exited with code 1
>     >         Results=Unloading drive 0 into Storage Element 3...Destination
>     >         Element Address 3 is Already Full
>     >         19-jun 22:06 servfich-sd JobId 53: 3301 Issuing autochanger
>     >         "loaded? drive 0" command.
>     >         19-jun 22:06 servfich-sd JobId 53: 3302 Autochanger "loaded?
>     >         drive 0", result: nothing loaded.
>     >         19-jun 22:06 servfich-sd JobId 53: 3301 Issuing autochanger
>     >         "loaded? drive 0" command.
>     >         19-jun 22:06 servfich-sd JobId 53: 3302 Autochanger "loaded?
>     >         drive 0", result: nothing loaded.
>     >         19-jun 22:06 servfich-sd JobId 53: 3301 Issuing autochanger
>     >         "loaded? drive 0" command.
>     >         19-jun
>      22:06 servfich-sd JobId 53: 3302 Autochanger "loaded?
>     >         drive 0", result: nothing loaded.
>     >         19-jun 22:06 servfich-sd JobId 53: 3304 Issuing autochanger
>     >         "load slot 4, drive 0" command.
>     >         19-jun 22:08 servfich-sd JobId 53: 3305 Autochanger "load
>     slot
>     >         4, drive 0", status is OK.
>     >         19-jun 22:08 servfich-sd JobId 53: 3301 Issuing autochanger
>     >         "loaded? drive 0" command.
>     >         19-jun 22:08 servfich-sd JobId 53: 3302 Autochanger "loaded?
>     >         drive 0", result is Slot 4.
>     >         19-jun 22:08 servfich-sd JobId 53: Error: block.c:995 Read
>     >         error on fd=6 at file:blk 0:0 on device "Driver1"
>     (/dev/nst0).
>     >         ERR=Input/output error.
>     >         19-jun 22:08 servfich-sd JobId 53: Error: block.c:995 Read
>     >         error on fd=6 at file:blk 0:0 on device "Driver1"
>     (/dev/nst0).
>     >        
>      ERR=Input/output error.
>     >         19-jun 22:08 servfich-sd JobId 53: Error: block.c:995 Read
>     >         error on fd=6 at file:blk 0:0 on device "Driver1"
>     (/dev/nst0).
>     >         ERR=Input/output error.
>     >         19-jun 22:08 servfich-sd JobId 53: Error: block.c:995 Read
>     >         error on fd=6 at file:blk 0:0 on device "Driver1"
>     (/dev/nst0).
>     >         ERR=Input/output error.
>     >         19-jun 22:08 servfich-sd JobId 53: Please mount Volume
>     >         "A0000004" or label a new one for:
>     >             Job:          Backup_de_Trabajo_Diario.2008-06-19_22.00.39
>     >             Storage:      "Driver1" (/dev/nst0)
>     >             Pool:         JuevesPool
>     >             Media type:   VXA-X23
>     >         19-jun 23:08 servfich-sd JobId 53: Please mount Volume
>     >         "A0000004" or label a new one for:
>     >             Job:         
>      Backup_de_Trabajo_Diario.2008-06-19_22.00.39
>     >             Storage:      "Driver1" (/dev/nst0)
>     >             Pool:         JuevesPool
>     >             Media type:   VXA-X23
>     >         20-jun 01:08 servfich-sd JobId 53: Please mount Volume
>     >         "A0000004" or label a new one for:
>     >             Job:          Backup_de_Trabajo_Diario.2008-06-19_22.00.39
>     >             Storage:      "Driver1" (/dev/nst0)
>     >             Pool:         JuevesPool
>     >             Media type:   VXA-X23
>     >         20-jun 05:08 servfich-sd JobId 53: Please mount Volume
>     >         "A0000004" or label a new one for:
>     >             Job:          Backup_de_Trabajo_Diario.2008-06-19_22.00.39
>     >             Storage:      "Driver1" (/dev/nst0)
>     >             Pool:         JuevesPool
>     >             Media type:   VXA-X23
>     >
>     >         I don't know why is it happening. I need some help of you.
>     > 
>             Thanks a lot.
>     >         --- El *vie, 13/6/08, Javier Rodriguez /<ungue79 AT yahoo DOT 
> es>/*
>     >         escribió:
>     >
>     >             De: Javier Rodriguez <ungue79 AT yahoo DOT es>
>     >             Asunto: Re: [Bacula-users] Please mount Volume
>     "A0000003"
>     >             or label a new one for...
>     >             Para: "John Drescher" <drescherjm AT gmail DOT com>
>     >             Fecha: viernes, 13 junio, 2008 9:16
>     >
>     >             I know that, but this tape has been written once.
>     >             Furthermore, i only had to type in bconcole unmount and
>     >             after mount with the slot 3 which is where A0000003 is in,
>     >             and everything ran fine.
>     >
>     >             Anyway, i'll see if next week i have the same problem with
>     >             that tape, If i have, then may be the tape doesn't work
>     >             very well.
>     >
>     >             Thanks a
>      lot.
>     >
>     >             --- El *jue, 12/6/08, John Drescher
>     >             /<drescherjm AT gmail DOT com>/* escribió:
>     >
>     >                 De: John Drescher <drescherjm AT gmail DOT com>
>     >                 Asunto: Re: [Bacula-users] Please mount Volume
>     >                 "A0000003" or label a new one for...
>     >                 Para: ungue79 AT yahoo DOT es, "baculausers"
>     >                 <Bacula-users AT lists.sourceforge DOT net>
>     >                 Fecha: jueves, 12 junio, 2008 2:56
>     >
>     >                 > 12-jun 08:07 servfich-sd JobId 47: Error: block.c:995
>     Read
>     >                  error on fd=6 at
>     >                 > file:blk 0:0 on device "Driver1"
>     (/dev/nst0). ERR=Input/output
>     >                 error.
>     >                 > 12-jun 08:07 servfich-sd JobId 47: Please mount
>     Volume
>     >                 "A0000003" or label a
>     >                 > new one
>      for:
>     >                 >
>     >                 You should not see this error on a tape that has been
>     written to it
>     >                 unless the tape or
>     >                  the drive is bad. If it is a never used tape this
>     >                 is a normal error because the drive will not let you 
> read
>     an unwritten
>     >                 tape.
>     >
>     >                 John
>     >
>     >
>     >            
>     ------------------------------------------------------------------------
>     >
>     >             Enviado desde Correo Yahoo!
>     >            
>     
> <http://us.rd.yahoo.com/mailuk/taglines/isp/control/*http://us.rd.yahoo.com/evt=52431/*http://es.docs.yahoo.com/mail/overview/index.html>
>     >             La bandeja de entrada más inteligente.
>     >
>     >
>     >        
>     ------------------------------------------------------------------------
>     >
>     >         Enviado desde Correo
>      Yahoo!
>     >        
>     
> <http://us.rd.yahoo.com/mailuk/taglines/isp/control/*http://us.rd.yahoo.com/evt=52431/*http://es.docs.yahoo.com/mail/overview/index.html>
>     >         La bandeja de entrada más inteligente.
>     >
>     >    
>     -------------------------------------------------------------------------
>     >     Check out the new SourceForge.net Marketplace.
>     >     It's the best place to buy or sell services for
>     >     just about anything Open Source.
>     >     http://sourceforge.net/services/buy/index.php
>     >
>     >     _______________________________________________
>     >     Bacula-users mailing list
>     >     Bacula-users AT lists.sourceforge DOT net
>     >     https://lists.sourceforge.net/lists/listinfo/bacula-users
>     >
>     >
>     > ------------------------------------------------------------------------
>     >
>     > Enviado desde Correo Yahoo!
>      
>     >
>     
> <http://us.rd.yahoo.com/mailuk/taglines/isp/control/*http://us.rd.yahoo.com/evt=52431/*http://es.docs.yahoo.com/mail/overview/index.html>
>     > La bandeja de entrada más inteligente.
>     > ------------------------------------------------------------------------
>     >
>     > 
> -------------------------------------------------------------------------
>     > Check out the new SourceForge.net Marketplace.
>     > It's the best place to buy or sell services for
>     > just about anything Open Source.
>     > http://sourceforge.net/services/buy/index.php
>     > ------------------------------------------------------------------------
>     >
>     > _______________________________________________
>     > Bacula-users mailing list
>     > Bacula-users AT lists.sourceforge DOT net
>     > https://lists.sourceforge.net/lists/listinfo/bacula-users
>     >
> 
> 
> 
> Enviado desde Correo Yahoo! 
> <http://us.rd.yahoo.com/mailuk/taglines/isp/control/*http://us.rd.yahoo.com/evt=52431/*http://es.docs.yahoo.com/mail/overview/index.html>
> La bandeja de entrada más inteligente.
> 
> 
> ------------------------------------------------------------------------
> 
> -------------------------------------------------------------------------
> Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
> Studies have shown that voting for your favorite open source project,
> along with a healthy diet, reduces your potential for chronic lameness
> and boredom. Vote Now at http://www.sourceforge.net/community/cca08
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Bacula-users mailing list
> Bacula-users AT lists.sourceforge DOT net
> https://lists.sourceforge.net/lists/listinfo/bacula-users

-- 
Arno Lehmann
IT-Service Lehmann
www.its-lehmann.de

-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
Bacula-users mailing list
Bacula-users AT lists.sourceforge DOT net
https://lists.sourceforge.net/lists/listinfo/bacula-users