Bacula-users

Re: [Bacula-users] mtx: Unknown Storage Element Loaded

2009-08-14 14:47:21
Subject: Re: [Bacula-users] mtx: Unknown Storage Element Loaded
From: John Drescher <drescherjm AT gmail DOT com>
To: Dan Langille <dan AT langille DOT org>
Date: Fri, 14 Aug 2009 14:42:32 -0400
On Fri, Aug 14, 2009 at 2:28 PM, Dan Langille<dan AT langille DOT org> wrote:
>
> On Fri, August 14, 2009 1:43 pm, John Drescher wrote:
>> On Fri, Aug 14, 2009 at 1:26 PM, Dan Langille<dan AT langille DOT org> wrote:
>>>
>>> On Fri, August 14, 2009 12:23 pm, John Drescher wrote:
>>>> On Fri, Aug 14, 2009 at 12:01 PM, Dan Langille<dan AT langille DOT org> 
>>>> wrote:
>>>>> On Fri, August 14, 2009 11:39 am, Dan Langille wrote:
>>>>>>
>>>>>> On Fri, August 14, 2009 11:13 am, Dan Langille wrote:
>>>>>>> Changing the subject, given the change in subject.  :)
>>>>>>>
>>>>>>> On Thu, August 13, 2009 3:14 pm, John Drescher wrote:
>>>>>>>> On Thu, Aug 13, 2009 at 3:09 PM, John
>>>>>>>> Drescher<drescherjm AT gmail DOT com>
>>>>>>>> wrote:
>>>>>>>>> On Thu, Aug 13, 2009 at 2:45 PM, Dan Langille<dan AT langille DOT org>
>>>>>>>>> wrote:
>>>>>>>>>> On Thu, August 13, 2009 2:27 pm, Dan Langille wrote:
>>>>>>>>>>>
>>>>>>>>>>> On Thu, August 13, 2009 1:19 pm, Dan Langille wrote:
>>>>>>>>>>>> I am setting up a new autochanger / tape drive.  I'm trying to
>>>>>>>>>>>> run
>>>>>>>>>>>> btape.
>>>>>>>>>>>> The basic test works, but I see this message when I start
>>>>>>>>>>>> btape:
>>>>>>>>>>>>
>>>>>>>>>>>>  Autochanger "loaded? drive 0", result: nothing loaded.
>>>>>>>>>>>>
>>>>>>>>>>>> mtx-changer [and mtx] both disagree with this:
>>>>>>>>>>>>
>>>>>>>>>>>> $ sudo /etc/bacula/mtx-changer /dev/sg4 loaded 0 /dev/nst0 0
>>>>>>>>>>>> AAM240L4
>>>>>>>>>>>
>>>>>>>>>>> That is a problem.  You don't want the label.  You want the slt
>>>>>>>>>>> it
>>>>>>>>>>> came
>>>>>>>>>>> from.  See
>>>>>>>>>>> http://www.bacula.org/en/dev-manual/Autochanger_Resource.html#SECTION0017130000000000000000
>>>>>>>>>>>
>>>>>>>>>>>     loaded -- returns number of the slot that is loaded, base 1,
>>>>>>>>>>>               in the drive or 0 if the drive is empty.
>>>>>>>>>>>
>>>>>>>>>>> Current problem: I can't see how to get this information from
>>>>>>>>>>> the
>>>>>>>>>>> device.
>>>>>>>>>>> I'll keep working on it:
>>>>>>>>>>>
>>>>>>>>>>> $ sudo /usr/sbin/mtx -f /dev/sg4 inquiry
>>>>>>>>>>> Password:
>>>>>>>>>>> Product Type: Medium Changer
>>>>>>>>>>> Vendor ID: 'QUANTUM '
>>>>>>>>>>> Product ID: 'PX500           '
>>>>>>>>>>> Revision: '0033'
>>>>>>>>>>> Attached Changer: No
>>>>>>>>>>> [dlangille@backup01 bacula]$
>>>>>>>>>>
>>>>>>>>>> I think we have a problem:
>>>>>>>>>>
>>>>>>>>>> [dlangille@backup01 bacula]$ sudo /usr/sbin/mtx -f /dev/sg4 load
>>>>>>>>>> 3
>>>>>>>>>> [dlangille@backup01 bacula]$ sudo /usr/sbin/mtx -f /dev/sg4
>>>>>>>>>> status
>>>>>>>>>>  Storage Changer /dev/sg4:1 Drives, 38 Slots ( 36 Import/Export )
>>>>>>>>>> Data Transfer Element 0:Full (Unknown Storage Element
>>>>>>>>>> Loaded):VolumeTag
>>>>>>>>>> =
>>>>>>>>>> AAM240L4
>>>>>>>>>>      Storage Element 1:Empty
>>>>>>>>>>      Storage Element 2:Empty
>>>>>>>>>>      Storage Element 3 IMPORT/EXPORT:Empty
>>>>>>>>>>      Storage Element 4 IMPORT/EXPORT:Full :VolumeTag=AAM241L4
>>>>>>>>>>
>>>>>>>>>> Should that 'Unknown Storage Element Loaded' be a 3 to indicate
>>>>>>>>>> the
>>>>>>>>>> slot
>>>>>>>>>> it came from?
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Here is what my mtx output looks like
>>>>>>>>>
>>>>>>>>> dev6 ~ # mtx -f /dev/autochanger1 status
>>>>>>>>>  Storage Changer /dev/autochanger1:2 Drives, 24 Slots ( 1
>>>>>>>>> Import/Export
>>>>>>>>> )
>>>>>>>>> Data Transfer Element 0:Full (Storage Element 17 Loaded):VolumeTag
>>>>>>>>> =
>>>>>>>>> A00036
>>>>>>>>> Data Transfer Element 1:Empty
>>>>>>>>>      Storage Element 1:Full :VolumeTag=A00030
>>>>>>>>>      Storage Element 2:Empty:VolumeTag=
>>>>>>>>>      Storage Element 3:Full :VolumeTag=A00058
>>>>>>>>>      Storage Element 4:Full :VolumeTag=A00053
>>>>>>>>>      Storage Element 5:Full :VolumeTag=A00023
>>>>>>>>>      Storage Element 6:Full :VolumeTag=A00006
>>>>>>>>>      Storage Element 7:Full :VolumeTag=A00007
>>>>>>>>>      Storage Element 8:Full :VolumeTag=A00052
>>>>>>>>>      Storage Element 9:Full :VolumeTag=A00028
>>>>>>>>>      Storage Element 10:Full :VolumeTag=A00020
>>>>>>>>>      Storage Element 11:Full :VolumeTag=A00054
>>>>>>>>>      Storage Element 12:Full :VolumeTag=A00039
>>>>>>>>>      Storage Element 13:Full :VolumeTag=A00048
>>>>>>>>>      Storage Element 14:Full :VolumeTag=A00012
>>>>>>>>>      Storage Element 15:Full :VolumeTag=A00068
>>>>>>>>>      Storage Element 16:Full :VolumeTag=A00069
>>>>>>>>>      Storage Element 17:Empty:VolumeTag=
>>>>>>>>>      Storage Element 18:Full :VolumeTag=A00065
>>>>>>>>>      Storage Element 19:Full :VolumeTag=A00066
>>>>>>>>>      Storage Element 20:Full :VolumeTag=A00067
>>>>>>>>>      Storage Element 21:Full :VolumeTag=A00062
>>>>>>>>>      Storage Element 22:Full :VolumeTag=A00063
>>>>>>>>>      Storage Element 23:Full :VolumeTag=A00064
>>>>>>>>>      Storage Element 24 IMPORT/EXPORT:Full :VolumeTag=A00029
>>>>>>>>>
>>>>>>>>> What version of mtx are you using?
>>>>>>>>>
>>>>>>>>> dev6 ~ # equery l mtx
>>>>>>>>> [ Searching for package 'mtx' in all categories among: ]
>>>>>>>>>  * installed packages
>>>>>>>>> [I--] [  ] sys-block/mtx-1.2.18 (0)
>>>>>>>>>
>>>>>>>>> It looks like I have 1.2.18
>>>>>>>>>
>>>>>>>>> John
>>>>>>>>>
>>>>>>>>
>>>>>>>> Ahh. If I manually load a tape using controls on the archive I get
>>>>>>>> the
>>>>>>>> same. Bacula will pick this up correctly if I update slots in the
>>>>>>>> console however.
>>>>>>>>
>>>>>>>> dev6 ~ # mtx -f /dev/autochanger1 status
>>>>>>>>   Storage Changer /dev/autochanger1:2 Drives, 24 Slots ( 1
>>>>>>>> Import/Export
>>>>>>>> )
>>>>>>>> Data Transfer Element 0:Full (Storage Element 17 Loaded):VolumeTag
>>>>>>>> =
>>>>>>>> A00036
>>>>>>>> Data Transfer Element 1:Full (Unknown Storage Element
>>>>>>>> Loaded):VolumeTag
>>>>>>>> =
>>>>>>>> A00029
>>>>>>>>       Storage Element 1:Full :VolumeTag=A00030
>>>>>>>>       Storage Element 2:Empty:VolumeTag=
>>>>>>>>       Storage Element 3:Full :VolumeTag=A00058
>>>>>>>>       Storage Element 4:Full :VolumeTag=A00053
>>>>>>>>       Storage Element 5:Full :VolumeTag=A00023
>>>>>>>>       Storage Element 6:Full :VolumeTag=A00006
>>>>>>>>       Storage Element 7:Full :VolumeTag=A00007
>>>>>>>>       Storage Element 8:Full :VolumeTag=A00052
>>>>>>>>       Storage Element 9:Full :VolumeTag=A00028
>>>>>>>>       Storage Element 10:Full :VolumeTag=A00020
>>>>>>>>       Storage Element 11:Full :VolumeTag=A00054
>>>>>>>>       Storage Element 12:Full :VolumeTag=A00039
>>>>>>>>       Storage Element 13:Full :VolumeTag=A00048
>>>>>>>>       Storage Element 14:Full :VolumeTag=A00012
>>>>>>>>       Storage Element 15:Full :VolumeTag=A00068
>>>>>>>>       Storage Element 16:Full :VolumeTag=A00069
>>>>>>>>       Storage Element 17:Empty:VolumeTag=
>>>>>>>>       Storage Element 18:Full :VolumeTag=A00065
>>>>>>>>       Storage Element 19:Full :VolumeTag=A00066
>>>>>>>>       Storage Element 20:Full :VolumeTag=A00067
>>>>>>>>       Storage Element 21:Full :VolumeTag=A00062
>>>>>>>>       Storage Element 22:Full :VolumeTag=A00063
>>>>>>>>       Storage Element 23:Full :VolumeTag=A00064
>>>>>>>>       Storage Element 24 IMPORT/EXPORT:Empty:VolumeTag=
>>>>>>>
>>>>>>> My status output has reverted to 'Unknown Storage Element Loaded'
>>>>>>> today.
>>>>>>> I don't know why.  'update slots' does not affect the situation.
>>>>>>>  This
>>>>>>> means that 'loaded' does not return the correct value.  This renders
>>>>>>> the
>>>>>>> autochanger useless.  I'd like to know how to get this working.
>>>>>>
>>>>>> I had tried the 'update slots' approach.  That doesn't fix it.  What
>>>>>> does
>>>>>> fix it is getting Bacula to load a tape into the drive.  I achieved
>>>>>> that
>>>>>> by running a job.  I now see:
>>>>>>
>>>>>>    Data Transfer Element 0:Full (Storage Element 2 Loaded):VolumeTag
>>>>>> =
>>>>>> AAM241L4
>>>>>
>>>>> I dispute the above now.
>>>>>
>>>>> I go with what Alan Brown said:
>>>>>
>>>>>> This happens consistently with tapes loaded out of i/o slots and the
>>>>>> only
>>>>>> solution I've found is not to put tapes in them.
>>>>>
>>>>> We have 38 slots, 36 of which are labeled IMPORT/EXPORT.  Seems I
>>>>> should
>>>>> change this.  I hope it is configurable.
>>>>>
>>>> I can tell you that my IMPORT/EXPORT slot does work correctly after a
>>>> slight modification of the mtx-changer script. Although after I put a
>>>> tape in it the first time I run update slots bacula says there are 23
>>>> slots instead of 24 so it ignores slot 24. I run update slots a second
>>>> time and all is well.
>>>
>>> What did your mtx-changer modification do?
>>>
>>
>> dev6 bacula # cat mtx-changer.patch
>> --- mtx-changer.old     2008-05-15 15:32:59.000000000 +0200
>> +++ mtx-changer 2008-05-15 15:13:12.000000000 +0200
>> @@ -188,7 +188,7 @@
>>  #     ${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=\)*//"
>> +      cat ${TMPFILE} | sed "s/ IMPORT\/EXPORT//" | 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.
>
> That is similar to what I created:
>
> cat ${TMPFILE} | grep " Storage Element [0-9]*.*:Full" | sed -r 's/[
> ]+Storage Element ([0-9]+)( IMPORT\/EXPORT)?\:Full
> \:VolumeTag=(.*)/\1:\3/'
>
>
>> This was added for bacula to recognize the barcode for slots labeled
>> IMPORT/EXPORT. I kind of doubt that this is your issue.
>
> Agreed.  It was an issue, fixed with the above.
>
>> Can you post the output of update slots. And possibly query 15
>
>
> *update slots
> The defined Storage resources are:
>     1: File
>     2: LTO-4
> Select Storage resource (1-2): 2
> Connecting to Storage daemon LTO-4 at localhost:9103 ...
> 3306 Issuing autochanger "slots" command.
> Device "LTO-4" has 38 slots.
> Connecting to Storage daemon LTO-4 at localhost:9103 ...
> 3306 Issuing autochanger "list" command.
> Catalog record for Volume "AAM275L4" updated to reference slot 2.
> Catalog record for Volume "AAM242L4" updated to reference slot 3.
> Catalog record for Volume "AAM265L4" updated to reference slot 4.
> Catalog record for Volume "AAM241L4" updated to reference slot 5.
> Catalog record for Volume "AAM243L4" updated to reference slot 6.
> Catalog record for Volume "AAM244L4" updated to reference slot 7.
> Catalog record for Volume "AAM245L4" updated to reference slot 8.
> Catalog record for Volume "AAM246L4" updated to reference slot 9.
> Catalog record for Volume "AAM247L4" updated to reference slot 10.
> Catalog record for Volume "AAM248L4" updated to reference slot 11.
> Catalog record for Volume "AAM249L4" updated to reference slot 12.
> Catalog record for Volume "AAM250L4" updated to reference slot 13.
> Catalog record for Volume "AAM251L4" updated to reference slot 14.
> Catalog record for Volume "AAM252L4" updated to reference slot 15.
> Catalog record for Volume "AAM253L4" updated to reference slot 16.
> Catalog record for Volume "AAM254L4" updated to reference slot 17.
> Catalog record for Volume "AAM255L4" updated to reference slot 18.
> Catalog record for Volume "AAM256L4" updated to reference slot 19.
> Catalog record for Volume "AAM257L4" updated to reference slot 20.
> Catalog record for Volume "AAM258L4" updated to reference slot 21.
> Catalog record for Volume "AAM259L4" updated to reference slot 22.
> Catalog record for Volume "AAM260L4" updated to reference slot 23.
> Catalog record for Volume "AAM261L4" updated to reference slot 24.
> Catalog record for Volume "AAM262L4" updated to reference slot 25.
> Catalog record for Volume "AAM263L4" updated to reference slot 26.
> Catalog record for Volume "AAM264L4" updated to reference slot 27.
> Catalog record for Volume "AAM240L4" updated to reference slot 28.
> Catalog record for Volume "AAM266L4" updated to reference slot 29.
> Catalog record for Volume "AAM267L4" updated to reference slot 30.
> Catalog record for Volume "AAM268L4" updated to reference slot 31.
> Catalog record for Volume "AAM269L4" updated to reference slot 32.
> Catalog record for Volume "AAM270L4" updated to reference slot 33.
> Catalog record for Volume "AAM271L4" updated to reference slot 34.
> Catalog record for Volume "AAM272L4" updated to reference slot 35.
> Catalog record for Volume "AAM273L4" updated to reference slot 36.
> Catalog record for Volume "AAM274L4" updated to reference slot 1.
> *query
> Available queries:
>     1: List up to 20 places where a File is saved regardless of the
> directory
>     2: List where the most recent copies of a file are saved
>     3: List last 20 Full Backups for a Client
>     4: List all backups for a Client after a specified time
>     5: List all backups for a Client
>     6: List Volume Attributes for a selected Volume
>     7: List Volumes used by selected JobId
>     8: List Volumes to Restore All Files
>     9: List Pool Attributes for a selected Pool
>    10: List total files/bytes by Job
>    11: List total files/bytes by Volume
>    12: List Files for a selected JobId
>    13: List Jobs stored on a selected MediaId
>    14: List Jobs stored for a given Volume name
>    15: List Volumes Bacula thinks are in changer
>    16: List Volumes likely to need replacement from age or errors
> Choose a query (1-16): 15
> +---------+------------+---------+---------+------+---------+-----------+-----------+
> | MediaId | VolumeName | GB      | Storage | Slot | Pool    | MediaType |
> VolStatus |
> +---------+------------+---------+---------+------+---------+-----------+-----------+
> |      35 | AAM274L4   | 0.0001  | LTO-4   |    1 | Default | LTO-4     |
> Full      |
> |      39 | AAM275L4   | 0.0001  | LTO-4   |    2 | Default | LTO-4     |
> Append    |
> |       3 | AAM242L4   | 0.0001  | LTO-4   |    3 | Default | LTO-4     |
> Append    |
> |      26 | AAM265L4   | 0.0001  | LTO-4   |    4 | Default | LTO-4     |
> Append    |
> |      38 | AAM241L4   | 0.0005  | LTO-4   |    5 | Default | LTO-4     |
> Full      |
> |       4 | AAM243L4   | 0.0001  | LTO-4   |    6 | Default | LTO-4     |
> Append    |
> |       5 | AAM244L4   | 0.0001  | LTO-4   |    7 | Default | LTO-4     |
> Append    |
> |       6 | AAM245L4   | 0.0001  | LTO-4   |    8 | Default | LTO-4     |
> Append    |
> |       7 | AAM246L4   | 0.0001  | LTO-4   |    9 | Default | LTO-4     |
> Append    |
> |       8 | AAM247L4   | 0.0001  | LTO-4   |   10 | Default | LTO-4     |
> Append    |
> |       9 | AAM248L4   | 0.0001  | LTO-4   |   11 | Default | LTO-4     |
> Append    |
> |      10 | AAM249L4   | 0.0001  | LTO-4   |   12 | Default | LTO-4     |
> Append    |
> |      11 | AAM250L4   | 0.0001  | LTO-4   |   13 | Default | LTO-4     |
> Append    |
> |      12 | AAM251L4   | 0.0001  | LTO-4   |   14 | Default | LTO-4     |
> Append    |
> |      13 | AAM252L4   | 0.0001  | LTO-4   |   15 | Default | LTO-4     |
> Append    |
> |      14 | AAM253L4   | 0.0001  | LTO-4   |   16 | Default | LTO-4     |
> Append    |
> |      15 | AAM254L4   | 0.0001  | LTO-4   |   17 | Default | LTO-4     |
> Append    |
> |      16 | AAM255L4   | 0.0001  | LTO-4   |   18 | Default | LTO-4     |
> Append    |
> |      17 | AAM256L4   | 0.0001  | LTO-4   |   19 | Default | LTO-4     |
> Append    |
> |      18 | AAM257L4   | 0.0001  | LTO-4   |   20 | Default | LTO-4     |
> Append    |
> |      19 | AAM258L4   | 0.0001  | LTO-4   |   21 | Default | LTO-4     |
> Append    |
> |      20 | AAM259L4   | 0.0001  | LTO-4   |   22 | Default | LTO-4     |
> Append    |
> |      21 | AAM260L4   | 0.0001  | LTO-4   |   23 | Default | LTO-4     |
> Append    |
> |      22 | AAM261L4   | 0.0001  | LTO-4   |   24 | Default | LTO-4     |
> Append    |
> |      23 | AAM262L4   | 0.0001  | LTO-4   |   25 | Default | LTO-4     |
> Append    |
> |      24 | AAM263L4   | 0.0001  | LTO-4   |   26 | Default | LTO-4     |
> Append    |
> |      25 | AAM264L4   | 0.0001  | LTO-4   |   27 | Default | LTO-4     |
> Append    |
> |      37 | AAM240L4   | 0.0001  | LTO-4   |   28 | Default | LTO-4     |
> Append    |
> |      27 | AAM266L4   | 0.0001  | LTO-4   |   29 | Default | LTO-4     |
> Append    |
> |      28 | AAM267L4   | 0.0001  | LTO-4   |   30 | Default | LTO-4     |
> Append    |
> |      29 | AAM268L4   | 0.0001  | LTO-4   |   31 | Default | LTO-4     |
> Append    |
> |      30 | AAM269L4   | 0.0001  | LTO-4   |   32 | Default | LTO-4     |
> Append    |
> |      31 | AAM270L4   | 0.0001  | LTO-4   |   33 | Default | LTO-4     |
> Append    |
> |      32 | AAM271L4   | 0.0001  | LTO-4   |   34 | Default | LTO-4     |
> Append    |
> |      33 | AAM272L4   | 0.0001  | LTO-4   |   35 | Default | LTO-4     |
> Append    |
> |      34 | AAM273L4   | 0.0001  | LTO-4   |   36 | Default | LTO-4     |
> Append    |
> +---------+------------+---------+---------+------+---------+-----------+-----------+
>
>
The output looks good. Bacula is correctly recognizing the lablels and
putting that into the database correctly..

I am pretty sure Arno's advice is exactly what you need.

-- 
John M. Drescher

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Bacula-users mailing list
Bacula-users AT lists.sourceforge DOT net
https://lists.sourceforge.net/lists/listinfo/bacula-users