Re: [Bacula-users] Problems getting a tape library to work under FreeBSD

2018-02-07 Thread Dan Langille
> On Feb 7, 2018, at 1:04 PM, Dimitri Maziuk  wrote:
> 
> On 02/07/2018 11:57 AM, Dan Langille wrote:
>> Either Bacula is in charge of the changer or it is not.
> 
> Only when it's running a job. If access is not concurrent, then it's
> very likely the tool not cleaning up after itself properly or something.

What I mean: either use Bacula or not use Bacula.

The other tool is taking hold of the device and not releasing.  That is 
interfering with backups.

So.. make a decision: Bacula or not.

Then go from there.

--
Dan Langille - BSDCan / PGCon
d...@langille.org





signature.asc
Description: Message signed with OpenPGP
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot___
Bacula-users mailing list
Bacula-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users


Re: [Bacula-users] Problems getting a tape library to work under FreeBSD

2018-02-07 Thread Dimitri Maziuk
On 02/07/2018 11:57 AM, Dan Langille wrote:
> Either Bacula is in charge of the changer or it is not.

Only when it's running a job. If access is not concurrent, then it's
very likely the tool not cleaning up after itself properly or something.

-- 
Dimitri Maziuk
Programmer/sysadmin
BioMagResBank, UW-Madison -- http://www.bmrb.wisc.edu



signature.asc
Description: OpenPGP digital signature
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot___
Bacula-users mailing list
Bacula-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users


Re: [Bacula-users] Problems getting a tape library to work under FreeBSD

2018-02-07 Thread Dan Langille
Either Bacula is in charge of the changer or it is not.

-- 
Dan Langille - BSDCan / PGCon
d...@langille.org


> On Feb 7, 2018, at 12:48 PM, Kenneth Garges  wrote:
> 
> That might be the issue. Somebody does something in the web interface that 
> takes the changer offline, clicks OK at the warning message. Then later when 
> it’s back online FreeBSD doesn’t figure that out and needs a reboot. 
> 
> Probably an issue that should be addressed with FreeBSD rather than Bacula.
> 
> 
> 
> 
>> On 6Feb 2018, at 6:50 PM, Alan Brown  wrote:
>> 
>> On 07/02/18 02:01, Kenneth Garges wrote:
>>> Permissions and ownership are ok. I think I figured out the problem.
>>> 
>>> Both mtx and chio would work for a while, then stop working returning only 
>>> “Inappropriate ioctl for device” or other errors. The culprit I think is a 
>>> library management tool by Quantum. The library provides a web interface 
>>> that allows you to check status, move tapes around, and various utilities. 
>>> 
>>> Problem is if you use that web interface it gets the server (both Bacula SD 
>>> and Director on the same FreeBSD box) wedged such that mtx and chio always 
>>> fail.
>> 
>> Yes - and if it's about to do anything which takes the changer offline
>> the web ui gives a warning message and asked if you want to continue.
>> 
>>> Unknown to me, the operations staff had been using that web interface while 
>>> I was testing. After I asked them to stop my system seems to work reliably. 
>> 
>> I hope you changed the password and put the changer in its own IP subnet
>> after that.
>> 
>> I wrote some kludgy shell scripts (originally for Neo4000, then Neo 8000
>> and now Quantum i500 - portable as far as I know) which automate loading
>> and unloading of the changer (imported tapes are scattered randomly
>> around available slots to ensure even wear and tear) - these mean that
>> all operations staff have to do is open the magazine to load/unload
>> tapes when emailed to do so by Bacula.
>> 
>> Dan can probably improve them considerably.
>> 
>> As an adjunct to that another script works out which tapes are oldest
>> (if in the scratch pool) or about to expire (if none are in the scratch
>> pool) and asks staff to pull them out of the safe.
>> 
>> I also submitted some chages to the mtx-changer script a while ago which
>> check that the changer's actually ready before attempting to send it
>> commands. Kern's been sitting on them for a couple of years.
>> 
>> 
>> There are some pretty whizzy things you can do to monitor tape health
>> when a tape is in the changer using the sg_attr and sg_logs commands
>> that go _far _ beyond Tapealart or smartmontools capabilities.
>> 
>> I've submitted a number of updates to sg_utils and am in the process of
>> (slowly) reverse engineering what I can from the MAMs that's not well
>> documented using text output provided by veritape (proprietary, windows
>> tool from mptapes.com which reads MAMs).
>> 
>> Selfish motivation is (of course) to reduce the amount of time I have to
>> spend manually scanning tapes with the windows program/standalone
>> scanner then interpreting output. All of that information is available
>> when the tape is in the drive and with appropriate MAM reads at
>> load/unload it's possible to have the bacula server tell me when a tape
>> is approaching end of life (this is far more accurate than the metrics
>> bacula uses of simple load cycles.) - and more importantly, when tape
>> drives are going bad.
>> 
>> Having spent several man-years dealing with the fallout of bad LTO tapes
>> damaging drives and then those drives damaging tapes, I want to minimize
>> the pain if it ever happens again.
>> 
>> (LTO drives even return detailed information about the condition of each
>> of the heads if queried the right way. This data is interpreted by IBM
>> or HP's proprietary tools to give reports but they use the same queries
>> as sg_logs does to get it)
>> 
> 


--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Bacula-users mailing list
Bacula-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users


Re: [Bacula-users] Problems getting a tape library to work under FreeBSD

2018-02-07 Thread Kenneth Garges
That might be the issue. Somebody does something in the web interface that 
takes the changer offline, clicks OK at the warning message. Then later when 
it’s back online FreeBSD doesn’t figure that out and needs a reboot. 

Probably an issue that should be addressed with FreeBSD rather than Bacula.




> On 6Feb 2018, at 6:50 PM, Alan Brown  wrote:
> 
> On 07/02/18 02:01, Kenneth Garges wrote:
>> Permissions and ownership are ok. I think I figured out the problem.
>> 
>> Both mtx and chio would work for a while, then stop working returning only 
>> “Inappropriate ioctl for device” or other errors. The culprit I think is a 
>> library management tool by Quantum. The library provides a web interface 
>> that allows you to check status, move tapes around, and various utilities. 
>> 
>> Problem is if you use that web interface it gets the server (both Bacula SD 
>> and Director on the same FreeBSD box) wedged such that mtx and chio always 
>> fail.
> 
> Yes - and if it's about to do anything which takes the changer offline
> the web ui gives a warning message and asked if you want to continue.
> 
>> Unknown to me, the operations staff had been using that web interface while 
>> I was testing. After I asked them to stop my system seems to work reliably. 
> 
> I hope you changed the password and put the changer in its own IP subnet
> after that.
> 
> I wrote some kludgy shell scripts (originally for Neo4000, then Neo 8000
> and now Quantum i500 - portable as far as I know) which automate loading
> and unloading of the changer (imported tapes are scattered randomly
> around available slots to ensure even wear and tear) - these mean that
> all operations staff have to do is open the magazine to load/unload
> tapes when emailed to do so by Bacula.
> 
> Dan can probably improve them considerably.
> 
> As an adjunct to that another script works out which tapes are oldest
> (if in the scratch pool) or about to expire (if none are in the scratch
> pool) and asks staff to pull them out of the safe.
> 
> I also submitted some chages to the mtx-changer script a while ago which
> check that the changer's actually ready before attempting to send it
> commands. Kern's been sitting on them for a couple of years.
> 
> 
> There are some pretty whizzy things you can do to monitor tape health
> when a tape is in the changer using the sg_attr and sg_logs commands
> that go _far _ beyond Tapealart or smartmontools capabilities.
> 
> I've submitted a number of updates to sg_utils and am in the process of
> (slowly) reverse engineering what I can from the MAMs that's not well
> documented using text output provided by veritape (proprietary, windows
> tool from mptapes.com which reads MAMs).
> 
> Selfish motivation is (of course) to reduce the amount of time I have to
> spend manually scanning tapes with the windows program/standalone
> scanner then interpreting output. All of that information is available
> when the tape is in the drive and with appropriate MAM reads at
> load/unload it's possible to have the bacula server tell me when a tape
> is approaching end of life (this is far more accurate than the metrics
> bacula uses of simple load cycles.) - and more importantly, when tape
> drives are going bad.
> 
> Having spent several man-years dealing with the fallout of bad LTO tapes
> damaging drives and then those drives damaging tapes, I want to minimize
> the pain if it ever happens again.
> 
> (LTO drives even return detailed information about the condition of each
> of the heads if queried the right way. This data is interpreted by IBM
> or HP's proprietary tools to give reports but they use the same queries
> as sg_logs does to get it)
> 


--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Bacula-users mailing list
Bacula-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users


Re: [Bacula-users] Problems getting a tape library to work under FreeBSD

2018-02-07 Thread Alan Brown

On 07/02/18 02:50, Alan Brown wrote:


I also submitted some chages to the mtx-changer script a while ago which
check that the changer's actually ready before attempting to send it
commands. Kern's been sitting on them for a couple of years.



@ -82,6 +66,7 @@ #$1  $2   $3 
$4   $

 fi

 MTX=/usr/sbin/mtx
+TAPEINFO=/usr/sbin/tapeinfo

 if test ${debug_log} -ne 0 ; then
   touch /opt/bacula/working/mtx.log
@@ -93,7 +78,21 @@ #   $1  $2 $3
$4   $

 fi
 }

-
+# AB 20151203 - wait for changer to be ready
+# wait up to 600 seconds
+i=0
+  while [ $i -le 600 ]; do  # Wait max 600 seconds
+if $TAPEINFO -f $1  2>&1 | grep "Ready: yes" >/dev/null 2>&1; then
+  if [ $i -gt 0 ]; then # Flush out any mtx bogosity.
+   $MTX status > /dev/null 2>&1
+  fi
+  break
+fi
+debug $dbglvl "Device $1 - not ready, retrying..."
+sleep 1
+i=`expr $i + 1`
+  done
+#
 #
 # Create a temporary file
 #
@@ -135,7 +134,12 @@ # $1  $2 $3
$4   $

 # 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.
+#   waiting a maximum of 600 seconds.
+#
+# AJB2: (was 300, updated to 600 because if the drive decides it needs
+# a cleaning cycle that could take longer than 5 minutes depending on the
+# age of the cleaning tape.)
+#
 # 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.
@@ -144,7 +148,7 @@ #   waiting a maximum of 300 seconds.
 #
 wait_for_drive() {
   i=0
-  while [ $i -le 300 ]; do  # Wait max 300 seconds
+  while [ $i -le 600 ]; do  # Wait max 600 seconds
 if mt -f $1 status 2>&1 | grep "${ready}" >/dev/null 2>&1; then
   break
 fi


--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Bacula-users mailing list
Bacula-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users


Re: [Bacula-users] Problems getting a tape library to work under FreeBSD

2018-02-06 Thread Alan Brown
On 07/02/18 02:01, Kenneth Garges wrote:
> Permissions and ownership are ok. I think I figured out the problem.
>
> Both mtx and chio would work for a while, then stop working returning only 
> “Inappropriate ioctl for device” or other errors. The culprit I think is a 
> library management tool by Quantum. The library provides a web interface that 
> allows you to check status, move tapes around, and various utilities. 
>
> Problem is if you use that web interface it gets the server (both Bacula SD 
> and Director on the same FreeBSD box) wedged such that mtx and chio always 
> fail.

Yes - and if it's about to do anything which takes the changer offline
the web ui gives a warning message and asked if you want to continue.

> Unknown to me, the operations staff had been using that web interface while I 
> was testing. After I asked them to stop my system seems to work reliably. 

I hope you changed the password and put the changer in its own IP subnet
after that.

I wrote some kludgy shell scripts (originally for Neo4000, then Neo 8000
and now Quantum i500 - portable as far as I know) which automate loading
and unloading of the changer (imported tapes are scattered randomly
around available slots to ensure even wear and tear) - these mean that
all operations staff have to do is open the magazine to load/unload
tapes when emailed to do so by Bacula.

Dan can probably improve them considerably.

As an adjunct to that another script works out which tapes are oldest
(if in the scratch pool) or about to expire (if none are in the scratch
pool) and asks staff to pull them out of the safe.

I also submitted some chages to the mtx-changer script a while ago which
check that the changer's actually ready before attempting to send it
commands. Kern's been sitting on them for a couple of years.


There are some pretty whizzy things you can do to monitor tape health
when a tape is in the changer using the sg_attr and sg_logs commands
that go _far _ beyond Tapealart or smartmontools capabilities.

I've submitted a number of updates to sg_utils and am in the process of
(slowly) reverse engineering what I can from the MAMs that's not well
documented using text output provided by veritape (proprietary, windows
tool from mptapes.com which reads MAMs).

Selfish motivation is (of course) to reduce the amount of time I have to
spend manually scanning tapes with the windows program/standalone
scanner then interpreting output. All of that information is available
when the tape is in the drive and with appropriate MAM reads at
load/unload it's possible to have the bacula server tell me when a tape
is approaching end of life (this is far more accurate than the metrics
bacula uses of simple load cycles.) - and more importantly, when tape
drives are going bad.

Having spent several man-years dealing with the fallout of bad LTO tapes
damaging drives and then those drives damaging tapes, I want to minimize
the pain if it ever happens again.

(LTO drives even return detailed information about the condition of each
of the heads if queried the right way. This data is interpreted by IBM
or HP's proprietary tools to give reports but they use the same queries
as sg_logs does to get it)


--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Bacula-users mailing list
Bacula-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users


Re: [Bacula-users] Problems getting a tape library to work under FreeBSD

2018-02-06 Thread Dan Langille
> On Feb 6, 2018, at 9:01 PM, Kenneth Garges  wrote:
> 
> Permissions and ownership are ok. I think I figured out the problem.
> 
> Both mtx and chio would work for a while, then stop working returning only 
> “Inappropriate ioctl for device” or other errors. The culprit I think is a 
> library management tool by Quantum. The library provides a web interface that 
> allows you to check status, move tapes around, and various utilities. 
> 
> Problem is if you use that web interface it gets the server (both Bacula SD 
> and Director on the same FreeBSD box) wedged such that mtx and chio always 
> fail.
> 
> Unknown to me, the operations staff had been using that web interface while I 
> was testing. After I asked them to stop my system seems to work reliably. 
> 
> Thanks to all that chimed in on this thread. It was very helpful.

Wow, that would have been hard to track down.  How did you stumble across that?


-- 
Dan Langille - BSDCan / PGCon
d...@langille.org




--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Bacula-users mailing list
Bacula-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users


Re: [Bacula-users] Problems getting a tape library to work under FreeBSD

2018-02-06 Thread Kenneth Garges
Permissions and ownership are ok. I think I figured out the problem.

Both mtx and chio would work for a while, then stop working returning only 
“Inappropriate ioctl for device” or other errors. The culprit I think is a 
library management tool by Quantum. The library provides a web interface that 
allows you to check status, move tapes around, and various utilities. 

Problem is if you use that web interface it gets the server (both Bacula SD and 
Director on the same FreeBSD box) wedged such that mtx and chio always fail.

Unknown to me, the operations staff had been using that web interface while I 
was testing. After I asked them to stop my system seems to work reliably. 

Thanks to all that chimed in on this thread. It was very helpful.


> On 6Feb 2018, at 4:07 AM, Alan Brown  wrote:
> 
> On 03/02/18 13:45, Dan Langille wrote:
>>> *ahem*
>>> 
>>> MTX is _only_ designed to interface to scsi generic devices. Unless 
>>> /dev/pass42 is another name for the generic device you'll have problems.
>> Can confirm /dev/pass* devices on FreeBSD are the right thing to use. From 
>> https://dan.langille.org/2016/02/04/dell-tl4000-tape-library-running-btape-and-configuring-baculas-mtx-changer/
> 
> What about permissions and ownership vs what bacula-sd is running as?
> 
> 


--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Bacula-users mailing list
Bacula-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users


Re: [Bacula-users] Problems getting a tape library to work under FreeBSD

2018-02-06 Thread Dan Langille

-- 
Dan Langille - BSDCan / PGCon
d...@langille.org


> On Feb 6, 2018, at 7:07 AM, Alan Brown  wrote:
> 
> On 03/02/18 13:45, Dan Langille wrote:
>>> *ahem*
>>> 
>>> MTX is _only_ designed to interface to scsi generic devices. Unless 
>>> /dev/pass42 is another name for the generic device you'll have problems.
>> Can confirm /dev/pass* devices on FreeBSD are the right thing to use. From 
>> https://dan.langille.org/2016/02/04/dell-tl4000-tape-library-running-btape-and-configuring-baculas-mtx-changer/
> 
> What about permissions and ownership vs what bacula-sd is running as?

Good point.

I see that's not covered in the above, but is here: 
https://dan.langille.org/2016/02/07/using-a-dell-tl4000-with-baculas-bacula-sd-on-freebsd-with-zfs/

Look for /etc/group
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Bacula-users mailing list
Bacula-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users


Re: [Bacula-users] Problems getting a tape library to work under FreeBSD

2018-02-06 Thread Alan Brown

On 03/02/18 13:45, Dan Langille wrote:

*ahem*

MTX is _only_ designed to interface to scsi generic devices. Unless /dev/pass42 
is another name for the generic device you'll have problems.

Can confirm /dev/pass* devices on FreeBSD are the right thing to use. From 
https://dan.langille.org/2016/02/04/dell-tl4000-tape-library-running-btape-and-configuring-baculas-mtx-changer/


What about permissions and ownership vs what bacula-sd is running as?



--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Bacula-users mailing list
Bacula-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users


Re: [Bacula-users] Problems getting a tape library to work under FreeBSD

2018-02-03 Thread Dan Langille
> On Feb 2, 2018, at 7:07 AM, Alan Brown  wrote:
> 
> On 31/01/18 03:23, Kenneth Garges wrote:
>> I’m having trouble getting a tape library to work. Individual tape drive 
>> seems ok but the library sometimes makes btape hang requiring a reboot. Or 
>> it fails.
> 
> 
> >  # Define a Virtual autochanger
> 
> Remove anything you're not actually using.  They're just going to add 
> confusion.
> 
>> # Quantum Scalar i80 tape library at UCSC
>> # Hostname of library: core-prod-jb-2
>> #
>> Autochanger {
>>   Name = "core-prod-jb-2"
>>   Device = "Drive1"
>> # Device = "Drive2"
>>   Changer Command = "/usr/local/etc/bacula/mtx-changer %c %o %S %a %d"
>> #  Changer Device = /dev/ch0
>>   Changer Device = /dev/pass42
>> }
> 
> *ahem*
> 
> MTX is _only_ designed to interface to scsi generic devices. Unless 
> /dev/pass42 is another name for the generic device you'll have problems.

Can confirm /dev/pass* devices on FreeBSD are the right thing to use. From 
https://dan.langille.org/2016/02/04/dell-tl4000-tape-library-running-btape-and-configuring-baculas-mtx-changer/

$ sudo camcontrol devlist
 at scbus0 target 0 lun 0 (pass0,sa0)
 at scbus0 target 0 lun 1 (pass1,ch0)
 at scbus0 target 1 lun 0 (pass2,sa1)
 at scbus0 target 1 lun 1 (pass3,ch1)
at scbus1 target 0 lun 0 (ada0,pass4)
at scbus3 target 0 lun 0 (ada1,pass5)

CAM is the Common Access Method for the SCSI/ATA subsystem: 
https://www.freebsd.org/cgi/man.cgi?query=cam=4=FreeBSD+11.0-RELEASE


$ sudo mtx -f /dev/pass0 inquiry
Product Type: Tape Drive
Vendor ID: 'IBM '
Product ID: 'ULT3580-HH4 '
Revision: 'C7Q1'
Attached Changer API: No
 
$ sudo tapeinfo -f /dev/pass0
Product Type: Tape Drive
Vendor ID: 'IBM '
Product ID: 'ULT3580-HH4 '
Revision: 'C7Q1'
Attached Changer API: No
SerialNumber: '1K10012996'
MinBlock: 1
MaxBlock: 16777215
Ready: yes
BufferedMode: yes
Medium Type: 0x48
Density Code: 0x46
BlockSize: 0
DataCompEnabled: yes
DataCompCapable: yes
DataDeCompEnabled: yes
CompType: 0x1
DeCompType: 0x1
BOP: yes
Block Position: 0
Partition 0 Remaining Kbytes: -1
Partition 0 Size in Kbytes: -1
ActivePartition: 0
EarlyWarningSize: 0
 
$ sudo tapeinfo -f /dev/pass1
Product Type: Medium Changer
Vendor ID: 'IBM '
Product ID: '3573-TL '
Revision: 'B.60'
Attached Changer API: No
SerialNumber: '00X4U78G4272_LL0'
Ready: yes


--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Bacula-users mailing list
Bacula-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users


Re: [Bacula-users] Problems getting a tape library to work under FreeBSD

2018-02-02 Thread Kenneth Garges
Thanks for your help.

> On 2Feb 2018, at 4:07 AM, Alan Brown  wrote:
> 
> On 31/01/18 03:23, Kenneth Garges wrote:
>> I’m having trouble getting a tape library to work. Individual tape drive 
>> seems ok but the library sometimes makes btape hang requiring a reboot. Or 
>> it fails.
> 
> 
> >  # Define a Virtual autochanger
> 
> Remove anything you're not actually using.  They're just going to add 
> confusion.

We’re using the virtual auto changer. Works fine. I’m trying to add a tape 
library to a running system.


> 
>> # Quantum Scalar i80 tape library at UCSC
>> # Hostname of library: core-prod-jb-2
>> #
>> Autochanger {
>>   Name = "core-prod-jb-2"
>>   Device = "Drive1"
>> # Device = "Drive2"
>>   Changer Command = "/usr/local/etc/bacula/mtx-changer %c %o %S %a %d"
>> #  Changer Device = /dev/ch0
>>   Changer Device = /dev/pass42
>> }
> 
> *ahem*
> 
> MTX is _only_ designed to interface to scsi generic devices. Unless 
> /dev/pass42 is another name for the generic device you'll have problems.

I believe that /dev/pass42 is the generic SCSI device. /dev/ch0 is also 
provided. That’s what this implies:

# camcontrol devlist
…
   at scbus8 target 0 lun 0 (pass41,sa0)
  at scbus8 target 0 lun 1 (pass42,ch0)



> 
> What do "tapeinfo -f /dev/pass42" and "loaderinfo -f /dev/pass42" give you?
> 
> You should see something like this:
> 
> # tapeinfo -f /etc/bacula/DEVICES/MSSLYF-changer
> Product Type: Medium Changer
> Vendor ID: 'QUANTUM '
> Product ID: 'Scalar i500 '
> Revision: '690G'
> Attached Changer API: No
> SerialNumber: 'QUANTUMA0C0xx_LLA   '
> SCSI ID: 2
> SCSI LUN: 1
> Ready: yes
> 
> # loaderinfo -f /etc/bacula/DEVICES/MSSLYF-changer
> Product Type: Medium Changer
> Vendor ID: 'QUANTUM '
> Product ID: 'Scalar i500 '
> Revision: '690G'
> Attached Changer: No
> Bar Code Reader: Yes
> EAAP: Yes
> Number of Medium Transport Elements: 1
> Number of Storage Elements: 83
> Number of Import/Export Elements: 18
> Number of Data Transfer Elements: 6
> Transport Geometry Descriptor Page: Yes
> Invertable: No
> Device Configuration Page: Yes
> Storage: Data Transfer, Import/Export, Storage
> SCSI Media Changer (rev 2): No
> Transfer Medium Transport: ->Import/Export, ->Storage
> Transfer Storage: ->Data Transfer, ->Import/Export, ->Storage
> Transfer Import/Export: ->Data Transfer, ->Import/Export, ->Storage
> Transfer Data Transfer: ->Data Transfer, ->Import/Export, ->Storage
> Exchange Medium Transport: None
> Exchange Storage: None
> Exchange Import/Export: None
> Exchange Data Transfer: None
> 
> 

Yes I think these are good:

# tapeinfo -f /dev/pass42
Product Type: Medium Changer
Vendor ID: 'QUANTUM '
Product ID: 'Scalar i40-i80  '
Revision: '180G'
Attached Changer API: No
SerialNumber: 'QUANTUMD1H0420126_LLB   '
Ready: yes

# loaderinfo -f /dev/pass42
Product Type: Medium Changer
Vendor ID: 'QUANTUM '
Product ID: 'Scalar i40-i80  '
Revision: '180G'
Attached Changer: No
Bar Code Reader: Yes
EAAP: Yes
Number of Medium Transport Elements: 1
Number of Storage Elements: 49
Number of Import/Export Elements: 5
Number of Data Transfer Elements: 2
Transport Geometry Descriptor Page: Yes
Invertable: No
Device Configuration Page: Yes
Storage: Data Transfer, Import/Export, Storage
SCSI Media Changer (rev 2): No
Transfer Medium Transport: ->Import/Export, ->Storage
Transfer Storage: ->Data Transfer, ->Import/Export, ->Storage
Transfer Import/Export: ->Data Transfer, ->Import/Export, ->Storage
Transfer Data Transfer: ->Data Transfer, ->Import/Export, ->Storage
Exchange Medium Transport: None
Exchange Storage: None
Exchange Import/Export: None
Exchange Data Transfer: None

> Operating systems may provide a /dev/changer or /dev/chio device but that 
> doesn't mean it's the same thing as the generic.
> 
> The other thing to check is that the device is readable _and writable_ by the 
> UID that's running bacula-sd - the default for the /dev/pass devices on the 
> BSD systems here is 0600:root:operator and bacula-sd runs as user bacula.
> 

I set that up this way:
# ls -l /dev/pass41 /dev/pass42 /dev/ch0 /dev/nsa0
crw-rw  1 root  operator  0x77 Feb  1 16:03 /dev/ch0
crw-rw  1 root  operator  0x72 Feb  1 16:19 /dev/nsa0
crw-rw  1 root  operator  0xa2 Feb  1 16:03 /dev/pass41
crw-rw  1 root  operator  0xa3 Feb  1 16:03 /dev/pass42

UID bacula is in the operator group.


--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot___
Bacula-users mailing list
Bacula-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users


Re: [Bacula-users] Problems getting a tape library to work under FreeBSD

2018-02-02 Thread Alan Brown

On 31/01/18 03:23, Kenneth Garges wrote:

I’m having trouble getting a tape library to work. Individual tape drive seems 
ok but the library sometimes makes btape hang requiring a reboot. Or it fails.



>  # Define a Virtual autochanger

Remove anything you're not actually using.  They're just going to add 
confusion.



# Quantum Scalar i80 tape library at UCSC
# Hostname of library: core-prod-jb-2
#
Autochanger {
   Name = "core-prod-jb-2"
   Device = "Drive1"
# Device = "Drive2"
   Changer Command = "/usr/local/etc/bacula/mtx-changer %c %o %S %a %d"
#  Changer Device = /dev/ch0
   Changer Device = /dev/pass42
}


*ahem*

MTX is _only_ designed to interface to scsi generic devices. Unless 
/dev/pass42 is another name for the generic device you'll have problems.


What do "tapeinfo -f /dev/pass42" and "loaderinfo -f /dev/pass42" give you?

You should see something like this:

# tapeinfo -f /etc/bacula/DEVICES/MSSLYF-changer
Product Type: Medium Changer
Vendor ID: 'QUANTUM '
Product ID: 'Scalar i500 '
Revision: '690G'
Attached Changer API: No
SerialNumber: 'QUANTUMA0C0xx_LLA   '
SCSI ID: 2
SCSI LUN: 1
Ready: yes

# loaderinfo -f /etc/bacula/DEVICES/MSSLYF-changer
Product Type: Medium Changer
Vendor ID: 'QUANTUM '
Product ID: 'Scalar i500 '
Revision: '690G'
Attached Changer: No
Bar Code Reader: Yes
EAAP: Yes
Number of Medium Transport Elements: 1
Number of Storage Elements: 83
Number of Import/Export Elements: 18
Number of Data Transfer Elements: 6
Transport Geometry Descriptor Page: Yes
Invertable: No
Device Configuration Page: Yes
Storage: Data Transfer, Import/Export, Storage
SCSI Media Changer (rev 2): No
Transfer Medium Transport: ->Import/Export, ->Storage
Transfer Storage: ->Data Transfer, ->Import/Export, ->Storage
Transfer Import/Export: ->Data Transfer, ->Import/Export, ->Storage
Transfer Data Transfer: ->Data Transfer, ->Import/Export, ->Storage
Exchange Medium Transport: None
Exchange Storage: None
Exchange Import/Export: None
Exchange Data Transfer: None


Operating systems may provide a /dev/changer or /dev/chio device but 
that doesn't mean it's the same thing as the generic.


The other thing to check is that the device is readable _and writable_ 
by the UID that's running bacula-sd - the default for the /dev/pass 
devices on the BSD systems here is 0600:root:operator and bacula-sd runs 
as user bacula.




--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Bacula-users mailing list
Bacula-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users


Re: [Bacula-users] Problems getting a tape library to work under FreeBSD

2018-02-02 Thread Cejka Rudolf
Kenneth Garges wrote (2018/02/01):
> I tried chio but gave up on it because anything I did gave an
> "Inappropriate ioctl for device" error. Now that a reboot seems to
> have gotten mtx working I found that chio works too. 

Ok, mtx works just once after reboot. Some delay helps, or not?
And chio, is it the same and after reboot it works just once too?
It seems that it is in a command, which your library does not like
very much. Could you search if there is any library firmware update?

-- 
Rudolf Cejka  http://www.fit.vutbr.cz/~cejkar
Brno University of Technology, Faculty of Information Technology
Bozetechova 2, 612 66  Brno, Czech Republic

--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Bacula-users mailing list
Bacula-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users


Re: [Bacula-users] Problems getting a tape library to work under FreeBSD

2018-02-01 Thread Dan Langille
> On Feb 1, 2018, at 6:42 PM, Kenneth Garges  wrote:
> 
> This is really weird. 
> 
> First mtx works:
> 
> # mtx -f /dev/pass42 status
>   Storage Changer /dev/pass42:2 Drives, 54 Slots ( 5 Import/Export )
> Data Transfer Element 0:Empty
> Data Transfer Element 1:Full (Storage Element 1 Loaded):VolumeTag = 000600
>   
>   Storage Element 1:Empty:VolumeTag=
>   Storage Element 2:Empty:VolumeTag=
>   Storage Element 3:Empty:VolumeTag=
>   Storage Element 4:Empty:VolumeTag=
>   Storage Element 5:Empty:VolumeTag=
>   Storage Element 6:Empty:VolumeTag=
>   Storage Element 7:Empty:VolumeTag=
>   Storage Element 8:Empty:VolumeTag=
>   Storage Element 9:Empty:VolumeTag=
>   Storage Element 10:Empty:VolumeTag=
>   Storage Element 11:Empty:VolumeTag=
>   Storage Element 12:Empty:VolumeTag=
>   Storage Element 13:Empty:VolumeTag=
>   Storage Element 14:Empty:VolumeTag=
>   Storage Element 15:Full :VolumeTag=B1  
>   Storage Element 16:Full :VolumeTag=B2  
>   Storage Element 17:Full :VolumeTag=B3  
>   Storage Element 18:Full :VolumeTag=B4  
>   Storage Element 19:Empty:VolumeTag=
>   Storage Element 20:Empty:VolumeTag=
>   Storage Element 21:Empty:VolumeTag=
>   Storage Element 22:Empty:VolumeTag=
>   Storage Element 23:Empty:VolumeTag=
>   Storage Element 24:Full :VolumeTag=B5  
>   Storage Element 25:Empty:VolumeTag=
>   Storage Element 26:Empty:VolumeTag=
>   Storage Element 27:Empty:VolumeTag=
>   Storage Element 28:Empty:VolumeTag=
>   Storage Element 29:Empty:VolumeTag=
>   Storage Element 30:Empty:VolumeTag=
>   Storage Element 31:Empty:VolumeTag=
>   Storage Element 32:Empty:VolumeTag=
>   Storage Element 33:Empty:VolumeTag=
>   Storage Element 34:Empty:VolumeTag=
>   Storage Element 35:Empty:VolumeTag=
>   Storage Element 36:Empty:VolumeTag=
>   Storage Element 37:Empty:VolumeTag=
>   Storage Element 38:Empty:VolumeTag=
>   Storage Element 39:Empty:VolumeTag=
>   Storage Element 40:Empty:VolumeTag=
>   Storage Element 41:Empty:VolumeTag=
>   Storage Element 42:Empty:VolumeTag=
>   Storage Element 43:Empty:VolumeTag=
>   Storage Element 44:Empty:VolumeTag=
>   Storage Element 45:Empty:VolumeTag=
>   Storage Element 46:Empty:VolumeTag=
>   Storage Element 47:Empty:VolumeTag=
>   Storage Element 48:Empty:VolumeTag=
>   Storage Element 49:Empty:VolumeTag=
>   Storage Element 50 IMPORT/EXPORT:Empty:VolumeTag=   
>  
>   Storage Element 51 IMPORT/EXPORT:Empty:VolumeTag=   
>  
>   Storage Element 52 IMPORT/EXPORT:Empty:VolumeTag=   
>  
>   Storage Element 53 IMPORT/EXPORT:Empty:VolumeTag=   
>  
>   Storage Element 54 IMPORT/EXPORT:Empty:VolumeTag=   
>  
> 
> Try it again immediately afterwards and it doesn’t:

I suspect timing.  Set the sleep option in mtx-changer's config

It can take a while for a tape to settle and for the tape drive to be ready.
-- 
Dan Langille - BSDCan / PGCon
d...@langille.org




> 
> # mtx -f /dev/pass42 status
> RequestSense (0x03) failed
> mtx: Request Sense: Long Report=yes
> mtx: Request Sense: Valid Residual=no
> mtx: Request Sense: Error Code=0 (Unknown?!)
> mtx: 

Re: [Bacula-users] Problems getting a tape library to work under FreeBSD

2018-02-01 Thread Kenneth Garges

> On 31Jan 2018, at 12:57 AM, Cejka Rudolf  wrote:
> 
> Kenneth Garges wrote (2018/01/30):
>> I???m having trouble getting a tape library to work.
> 
> Hello, try chio status -v or mtx status. Both should return
> status of your autochanger including tape labels. If they both
> do return an error, do you have correct permissons on /dev/ch*?
> I have the following (please note the operator group):
> 
> bacula> ls -l /dev/ch*
> crw-rw  1 root  operator  0x9e 11 led 11:31 /dev/ch0
> bacula> id bacula
> uid=366(bacula) gid=366(bacula) groups=366(bacula),0(wheel),5(operator)
> 
> If mtx returns an error but chio does work, please try chio-changer-freebsd,
> which uses FreeBSD's native chio instead of mtx from ports.
> 
> -- 
> Rudolf Cejka  http://www.fit.vutbr.cz/~cejkar
> Brno University of Technology, Faculty of Information Technology
> Bozetechova 2, 612 66  Brno, Czech Republic



I tried chio but gave up on it because anything I did gave an "Inappropriate 
ioctl for device" error. Now that a reboot seems to have gotten mtx working I 
found that chio works too. 
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Bacula-users mailing list
Bacula-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users


Re: [Bacula-users] Problems getting a tape library to work under FreeBSD

2018-02-01 Thread Kenneth Garges
Thanks for all the suggestions.

> On 30Jan 2018, at 8:03 PM, Dan Langille  wrote:
> 
>> On Jan 30, 2018, at 10:23 PM, Kenneth Garges > > wrote:
>> 
>> I’m having trouble getting a tape library to work. Individual tape drive 
>> seems ok but the library sometimes makes btape hang requiring a reboot. Or 
>> it fails.
> 
> Fix that first.

I’m not sure how to fix it. Sometimes it just gets wedged into this state where 
even running mtx status will fail with Inquiry Command failed. Then a reboot 
and it works. For a while. Then something happens and it’s wedged again.



>> 
>> My system is FreeBSD 10.3-RELEASE-p24. I compiled bacula-9.0.6 from source. 
>> I have a Quantum Scalar i80 tape library with an LTO-4 drive attached via 
>> fiber channel. 
> 
> If you can I suggest using the packages.  It's what I do.  I am also the 
> FreeBSD packager.
> 
> I do not think this is the cause of the issues.
> 

I wanted to use a package but could not find any that had both psql and openssl 
options. 

>> 
>> #
>> # Define a Virtual autochanger
>> #
>> Autochanger {
>>  Name = FileChgr1
>>  Device = FileChgr1-Dev1, FileChgr1-Dev2
>>  Changer Command = ""
>>  Changer Device = /dev/null
>> }
> 
> I suggest trying must one Device in here for now.

Yes that’s what I’m doing with the tape library device. The second tape drive 
is commented out.


>> 
>> # btape -c /etc/bacula/bacula-sd.conf -v -d 99 /dev/nsa0
>> Tape block granularity is 1024 bytes.
>> btape: address_conf.c:274-0 Initaddr 0.0.0.0:9103 
>> btape: butil.c:290-0 Using device: "/dev/nsa0" for writing.
>> btape: autochanger.c:328-0 Locking changer core-prod-jb-2
>> 30-Jan 19:08 btape JobId 0: 3301 Issuing autochanger "loaded? drive 0" 
>> command.
>> btape: autochanger.c:284-0 Run program=/usr/local/etc/bacula/mtx-changer 
>> /dev/pass42 loaded 0 /dev/nsa0 0
>> btape: autochanger.c:286-0 run_prog: /usr/local/etc/bacula/mtx-changer 
>> /dev/pass42 loaded 0 /dev/nsa0 0 stat=268435457 result=RequestSense (0x03) 
>> failed
> 
> I think you need more testing on the command line with mtx-changer. See below.
> …

Yeah all those errors happened when it was wedged. I didn’t realize it. After a 
reboot they work. 


> 
> I have documented most of my setup procedure on FreeBSD.
> 
> Getting mtx working first.  Then mtx-changers.  Verify permissions on devices 
> for the bacula user.
> 
> These might help, based on 
> https://dan.langille.org/?s=mtx-changer= 
> 
> 
> https://dan.langille.org/2016/02/04/dell-tl4000-tape-library-running-btape-and-configuring-baculas-mtx-changer/
>  
> 
> 
> This example has more on permissions:
> 
> https://www.freebsddiary.org/tape-library-integration.php 
> 
> 
> Hope that gets you started.
> 
> -- 
> Dan Langille - BSDCan / PGCon
> d...@langille.org 

Thanks for your efforts documenting all this. I have read most if not all of it.


--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot___
Bacula-users mailing list
Bacula-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users


Re: [Bacula-users] Problems getting a tape library to work under FreeBSD

2018-01-31 Thread Cejka Rudolf
Kenneth Garges wrote (2018/01/30):
> I???m having trouble getting a tape library to work.

Hello, try chio status -v or mtx status. Both should return
status of your autochanger including tape labels. If they both
do return an error, do you have correct permissons on /dev/ch*?
I have the following (please note the operator group):

bacula> ls -l /dev/ch*
crw-rw  1 root  operator  0x9e 11 led 11:31 /dev/ch0
bacula> id bacula
uid=366(bacula) gid=366(bacula) groups=366(bacula),0(wheel),5(operator)

If mtx returns an error but chio does work, please try chio-changer-freebsd,
which uses FreeBSD's native chio instead of mtx from ports.

-- 
Rudolf Cejka  http://www.fit.vutbr.cz/~cejkar
Brno University of Technology, Faculty of Information Technology
Bozetechova 2, 612 66  Brno, Czech Republic

--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Bacula-users mailing list
Bacula-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users


Re: [Bacula-users] Problems getting a tape library to work under FreeBSD

2018-01-30 Thread Dan Langille
> On Jan 30, 2018, at 10:23 PM, Kenneth Garges  wrote:
> 
> I’m having trouble getting a tape library to work. Individual tape drive 
> seems ok but the library sometimes makes btape hang requiring a reboot. Or it 
> fails.

Fix that first.
> 
> My system is FreeBSD 10.3-RELEASE-p24. I compiled bacula-9.0.6 from source. I 
> have a Quantum Scalar i80 tape library with an LTO-4 drive attached via fiber 
> channel. 

If you can I suggest using the packages.  It's what I do.  I am also the 
FreeBSD packager.

I do not think this is the cause of the issues.

> 
> Most stuff seems ok:
> 
> # uname -a
> FreeBSD core-prod-bkp-3.ucsc.edu 10.3-RELEASE-p24 FreeBSD 10.3-RELEASE-p24 
> #0: Wed Nov 15 04:57:40 UTC 2017 
> r...@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC  amd64
> 
> # camcontrol devlist
>  at scbus0 target 8 lun 0 (pass0,da0)
>  at scbus0 target 9 lun 0 (pass1,da1)
>  at scbus0 target 10 lun 0 (pass2,da2)
>  at scbus0 target 11 lun 0 (pass3,da3)
>  at scbus0 target 12 lun 0 (pass4,da4)
>  at scbus0 target 13 lun 0 (pass5,da5)
>  at scbus0 target 14 lun 0 (pass6,da6)
>  at scbus0 target 15 lun 0 (pass7,da7)
>  at scbus0 target 16 lun 0 (pass8,da8)
>  at scbus0 target 17 lun 0 (pass9,da9)
>  at scbus0 target 18 lun 0 (pass10,da10)
>  at scbus0 target 19 lun 0 (pass11,da11)
>  at scbus0 target 20 lun 0 (pass12,da12)
>  at scbus0 target 21 lun 0 (pass13,da13)
>  at scbus0 target 22 lun 0 (pass14,da14)
>  at scbus0 target 23 lun 0 (pass15,da15)
>  at scbus0 target 24 lun 0 (pass16,da16)
>  at scbus0 target 25 lun 0 (pass17,da17)
>  at scbus0 target 26 lun 0 (pass18,da18)
>  at scbus0 target 27 lun 0 (pass19,da19)
>  at scbus0 target 28 lun 0 (pass20,da20)
>  at scbus0 target 29 lun 0 (pass21,da21)
>  at scbus0 target 30 lun 0 (pass22,da22)
>  at scbus0 target 31 lun 0 (pass23,da23)
>  at scbus0 target 32 lun 0 (pass24,ses0)
>  at scbus0 target 33 lun 0 (pass25,da24)
>  at scbus0 target 34 lun 0 (pass26,da25)
>  at scbus0 target 35 lun 0 (pass27,da26)
>  at scbus0 target 36 lun 0 (pass28,da27)
>  at scbus0 target 37 lun 0 (pass29,da28)
>  at scbus0 target 38 lun 0 (pass30,da29)
>  at scbus0 target 39 lun 0 (pass31,da30)
>  at scbus0 target 40 lun 0 (pass32,da31)
>  at scbus0 target 41 lun 0 (pass33,da32)
>  at scbus0 target 42 lun 0 (pass34,da33)
>  at scbus0 target 43 lun 0 (pass35,da34)
>  at scbus0 target 44 lun 0 (pass36,da35)
>  at scbus0 target 45 lun 0 (pass37,ses1)
> at scbus2 target 0 lun 0 (ada0,pass38)
>   at scbus5 target 0 lun 0 (ada1,pass39)
>at scbus7 target 0 lun 0 (pass40,ses2)
>at scbus8 target 0 lun 0 (pass41,sa0)
>   at scbus8 target 0 lun 1 (pass42,ch0)
> 
> # mt -f /dev/nsa0 status
> Drive: sa0:  Serial Number: C3898E4004
> -
> Mode  Density  Blocksize  bpi  Compression
> Current:  0x46:LTO-4   variable   323215   enabled (0x1)
> -
> Current Driver State: at rest.
> -
> Partition:   0  Calc File Number:   0 Calc Record Number: 0
> Residual:0  Reported File Number:   0 Reported Record Number: 0
> Flags: BOP
> 
> # mt -f /dev/nsa0 rewind
> # tar cvf /dev/nsa0 .
> a .
> a ./#make_catalog_backup.pl#
> a ./bacula-sd.conf~
> a ./master.key.info
> 
> (A bunch of files omitted)
> 
> # mt -f /dev/nsa0 rewind
> # tar tvf /dev/nsa0 
> drwxrwxr-x  0 bacula bacula  0 Jan 30 17:20 ./
> -rwxr-x---  0 root   bacula   4556 Dec 21 15:04 ./#make_catalog_backup.pl#
> -rw-rw  0 bacula bacula   3452 Jan 30 15:55 ./bacula-sd.conf~
> -rw-r--r--  0 root   bacula351 Dec 18 16:52 ./master.key.info
> 
> (Same files)
> 
> # cat /etc/bacula/bacula-sd.conf
> 
> #
> #  Bacula Storage Daemon Configuration file for UCSC
> # Updated 18 Jan 2018 Kenneth Garges
> #
> #  For Bacula release 7.4.7 (16 March 2017) -- freebsd 10.3-RELEASE-p20
> #
> # You may need to change the name of your tape drive
> #   on the "Archive Device" directive in the Device
> #   resource.  If you change the Name and/or the
> #   "Media Type" in the Device resource, please ensure
> #   that dird.conf has corresponding changes.
> #
> #
> # Copyright (C) 2000-2015 Kern Sibbald
> # License: BSD 2-Clause; see file LICENSE-FOSS
> #
> 
> Storage { # definition of myself
>   Name = core-prod-bkp-3-sd
>   SDPort = 9103  # Director's port
>   WorkingDirectory = "/var/db/bacula"
>   Pid Directory = "/var/run"
>   Maximum Concurrent Jobs = 20
> }
> 
> #
> # List Directors who are permitted to contact Storage daemon
> #
> Director {
>   Name = core-prod-bkp-3.ucsc.edu-dir
>   Password = “*"
> }
> 
> 
> #
> # Define a Virtual autochanger
> #
> Autochanger {
>   Name = FileChgr1
>   Device = FileChgr1-Dev1,