> On Jan 30, 2018, at 10:23 PM, Kenneth Garges <gar...@ucsc.edu> 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
> <HITACHI HUS723030ALS640 A350>     at scbus0 target 8 lun 0 (pass0,da0)
> <HITACHI HUS723030ALS640 A350>     at scbus0 target 9 lun 0 (pass1,da1)
> <HITACHI HUS723030ALS640 A350>     at scbus0 target 10 lun 0 (pass2,da2)
> <HITACHI HUS723030ALS640 A350>     at scbus0 target 11 lun 0 (pass3,da3)
> <HITACHI HUS723030ALS640 A350>     at scbus0 target 12 lun 0 (pass4,da4)
> <HITACHI HUS723030ALS640 A350>     at scbus0 target 13 lun 0 (pass5,da5)
> <HITACHI HUS723030ALS640 A350>     at scbus0 target 14 lun 0 (pass6,da6)
> <HITACHI HUS723030ALS640 A350>     at scbus0 target 15 lun 0 (pass7,da7)
> <HITACHI HUS723030ALS640 A350>     at scbus0 target 16 lun 0 (pass8,da8)
> <HITACHI HUS723030ALS640 A350>     at scbus0 target 17 lun 0 (pass9,da9)
> <HITACHI HUS723030ALS640 A350>     at scbus0 target 18 lun 0 (pass10,da10)
> <HITACHI HUS723030ALS640 A350>     at scbus0 target 19 lun 0 (pass11,da11)
> <HITACHI HUS723030ALS640 A350>     at scbus0 target 20 lun 0 (pass12,da12)
> <HITACHI HUS723030ALS640 A350>     at scbus0 target 21 lun 0 (pass13,da13)
> <HITACHI HUS723030ALS640 A350>     at scbus0 target 22 lun 0 (pass14,da14)
> <HITACHI HUS723030ALS640 A350>     at scbus0 target 23 lun 0 (pass15,da15)
> <HITACHI HUS723030ALS640 A350>     at scbus0 target 24 lun 0 (pass16,da16)
> <HITACHI HUS723030ALS640 A350>     at scbus0 target 25 lun 0 (pass17,da17)
> <HITACHI HUS723030ALS640 A350>     at scbus0 target 26 lun 0 (pass18,da18)
> <HITACHI HUS723030ALS640 A350>     at scbus0 target 27 lun 0 (pass19,da19)
> <HITACHI HUS723030ALS640 A350>     at scbus0 target 28 lun 0 (pass20,da20)
> <HITACHI HUS723030ALS640 A350>     at scbus0 target 29 lun 0 (pass21,da21)
> <HITACHI HUS723030ALS640 A350>     at scbus0 target 30 lun 0 (pass22,da22)
> <HITACHI HUS723030ALS640 A350>     at scbus0 target 31 lun 0 (pass23,da23)
> <LSI SAS2X36 0e0b>                 at scbus0 target 32 lun 0 (pass24,ses0)
> <HITACHI HUS723030ALS640 A350>     at scbus0 target 33 lun 0 (pass25,da24)
> <HITACHI HUS723030ALS640 A350>     at scbus0 target 34 lun 0 (pass26,da25)
> <HITACHI HUS723030ALS640 A350>     at scbus0 target 35 lun 0 (pass27,da26)
> <HITACHI HUS723030ALS640 A350>     at scbus0 target 36 lun 0 (pass28,da27)
> <HITACHI HUS723030ALS640 A350>     at scbus0 target 37 lun 0 (pass29,da28)
> <HITACHI HUS723030ALS640 A350>     at scbus0 target 38 lun 0 (pass30,da29)
> <HITACHI HUS723030ALS640 A440>     at scbus0 target 39 lun 0 (pass31,da30)
> <HITACHI HUS723030ALS640 A350>     at scbus0 target 40 lun 0 (pass32,da31)
> <HITACHI HUS723030ALS640 A350>     at scbus0 target 41 lun 0 (pass33,da32)
> <HITACHI HUS723030ALS640 A350>     at scbus0 target 42 lun 0 (pass34,da33)
> <HITACHI HUS723030ALS640 A350>     at scbus0 target 43 lun 0 (pass35,da34)
> <HITACHI HUS723030ALS640 A350>     at scbus0 target 44 lun 0 (pass36,da35)
> <LSI SAS2X28 0e0b>                 at scbus0 target 45 lun 0 (pass37,ses1)
> <SATA SSD S9FM01.6>                at scbus2 target 0 lun 0 (ada0,pass38)
> <InnoLite SATADOM D150QV-L 120319>  at scbus5 target 0 lun 0 (ada1,pass39)
> <AHCI SGPIO Enclosure 1.00 0001>   at scbus7 target 0 lun 0 (pass40,ses2)
> <HP Ultrium 4-SCSI V62Z>           at scbus8 target 0 lun 0 (pass41,sa0)
> <QUANTUM Scalar i40-i80 180G>      at scbus8 target 0 lun 1 (pass42,ch0)
> 
> # mt -f /dev/nsa0 status
> Drive: sa0: <HP Ultrium 4-SCSI V62Z> 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   bacula    351 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, FileChgr1-Dev2
>   Changer Command = ""
>   Changer Device = /dev/null
> }

I suggest trying must one Device in here for now.

> 
> Device {
>   Name = FileChgr1-Dev1
>   Media Type = File1
>   Archive Device = /backups
>   LabelMedia = yes;                   # lets Bacula label unlabeled media
>   Random Access = Yes;
>   AutomaticMount = yes;               # when device opened, read it
>   RemovableMedia = no;
>   AlwaysOpen = no;
>   Maximum Concurrent Jobs = 5
> }
> 
> Device {
>   Name = FileChgr1-Dev2
>   Media Type = File1
>   Archive Device = /backups
>   LabelMedia = yes;                   # lets Bacula label unlabeled media
>   Random Access = Yes;
>   AutomaticMount = yes;               # when device opened, read it
>   RemovableMedia = no;
>   AlwaysOpen = no;
>   Maximum Concurrent Jobs = 5
> }
> 
> 
> Device {
>   Name = "Drive1"
>   Media Type = LTO-4
>   Archive Device = /dev/nsa0
>   AutomaticMount = yes;               # when device opened, read it
>   AlwaysOpen = yes;
>   RemovableMedia = yes;
>   RandomAccess = no;
>   Maximum File Size = 5GB
> }
> 
> #
> # Send all messages to the Director,
> # mount messages also are sent to the email address
> #
> Messages {
>   Name = Standard
>   director = core-prod-bkp-3.ucsc.edu-dir = all
> }
> 
> 
> # btape -c /etc/bacula/bacula-sd.conf /dev/nsa0
> Tape block granularity is 1024 bytes.
> btape: butil.c:290-0 Using device: "/dev/nsa0" for writing.
> btape: btape.c:478-0 open device "Drive1" (/dev/nsa0): OK
> *test
> 
> === Write, rewind, and re-read test ===
> 
> I'm going to write 10000 records and an EOF
> then write 10000 records and an EOF, then rewind,
> and re-read the data to verify that it is correct.
> 
> This is an *essential* feature ...
> 
> btape: btape.c:1161-0 Wrote 10000 blocks of 64412 bytes.
> btape: btape.c:612-0 Wrote 1 EOF to "Drive1" (/dev/nsa0)
> btape: btape.c:1177-0 Wrote 10000 blocks of 64412 bytes.
> btape: btape.c:612-0 Wrote 1 EOF to "Drive1" (/dev/nsa0)
> btape: btape.c:1219-0 Rewind OK.
> 10000 blocks re-read correctly.
> Got EOF on tape.
> 10000 blocks re-read correctly.
> === Test Succeeded. End Write, rewind, and re-read test ===
> 
> btape: btape.c:1286-0 Block position test
> btape: btape.c:1297-0 Rewind OK.
> Reposition to file:block 0:4
> Block 5 re-read correctly.
> Reposition to file:block 0:200
> Block 201 re-read correctly.
> Reposition to file:block 0:9999
> Block 10000 re-read correctly.
> Reposition to file:block 1:0
> Block 10001 re-read correctly.
> Reposition to file:block 1:600
> Block 10601 re-read correctly.
> Reposition to file:block 1:9999
> Block 20000 re-read correctly.
> === Test Succeeded. End Write, rewind, and re-read test ===
> 
> 
> 
> === Append files test ===
> 
> This test is essential to Bacula.
> 
> I'm going to write one record  in file 0,
>                    two records in file 1,
>              and three records in file 2
> 
> btape: btape.c:582-0 Rewound "Drive1" (/dev/nsa0)
> btape: btape.c:1917-0 Wrote one record of 64412 bytes.
> btape: btape.c:1919-0 Wrote block to device.
> btape: btape.c:612-0 Wrote 1 EOF to "Drive1" (/dev/nsa0)
> btape: btape.c:1917-0 Wrote one record of 64412 bytes.
> btape: btape.c:1919-0 Wrote block to device.
> btape: btape.c:1917-0 Wrote one record of 64412 bytes.
> btape: btape.c:1919-0 Wrote block to device.
> btape: btape.c:612-0 Wrote 1 EOF to "Drive1" (/dev/nsa0)
> btape: btape.c:1917-0 Wrote one record of 64412 bytes.
> btape: btape.c:1919-0 Wrote block to device.
> btape: btape.c:1917-0 Wrote one record of 64412 bytes.
> btape: btape.c:1919-0 Wrote block to device.
> btape: btape.c:1917-0 Wrote one record of 64412 bytes.
> btape: btape.c:1919-0 Wrote block to device.
> btape: btape.c:612-0 Wrote 1 EOF to "Drive1" (/dev/nsa0)
> btape: btape.c:478-0 open device "Drive1" (/dev/nsa0): OK
> btape: btape.c:582-0 Rewound "Drive1" (/dev/nsa0)
> btape: btape.c:1430-0 Now moving to end of medium.
> btape: btape.c:633-0 Moved to end of medium.
> We should be in file 3. I am at file 3. This is correct!
> 
> Now the important part, I am going to attempt to append to the tape.
> 
> btape: btape.c:1917-0 Wrote one record of 64412 bytes.
> btape: btape.c:1919-0 Wrote block to device.
> btape: btape.c:612-0 Wrote 1 EOF to "Drive1" (/dev/nsa0)
> btape: btape.c:582-0 Rewound "Drive1" (/dev/nsa0)
> Done appending, there should be no I/O errors
> 
> Doing Bacula scan of blocks:
> 1 block of 64448 bytes in file 1
> End of File mark.
> 2 blocks of 64448 bytes in file 2
> End of File mark.
> 3 blocks of 64448 bytes in file 3
> End of File mark.
> 1 block of 64448 bytes in file 4
> End of File mark.
> Total files=4, blocks=7, bytes = 451,136
> End scanning the tape.
> We should be in file 4. I am at file 4. This is correct!
> 
> The above Bacula scan should have output identical to what follows.
> Please double check it ...
> === Sample correct output ===
> 1 block of 64448 bytes in file 1
> End of File mark.
> 2 blocks of 64448 bytes in file 2
> End of File mark.
> 3 blocks of 64448 bytes in file 3
> End of File mark.
> 1 block of 64448 bytes in file 4
> End of File mark.
> Total files=4, blocks=7, bytes = 451,136
> === End sample correct output ===
> 
> If the above scan output is not identical to the
> sample output, you MUST correct the problem
> or Bacula will not be able to write multiple Jobs to 
> the tape.
> 
> 
> === Write, backup, and re-read test ===
> 
> I'm going to write three records and an EOF
> then backup over the EOF and re-read the last record.
> Bacula does this after writing the last block on the
> tape to verify that the block was written correctly.
> 
> This is not an *essential* feature ...
> 
> btape: btape.c:582-0 Rewound "Drive1" (/dev/nsa0)
> btape: btape.c:820-0 Wrote first record of 64412 bytes.
> btape: btape.c:831-0 Wrote second record of 64412 bytes.
> btape: btape.c:842-0 Wrote third record of 64412 bytes.
> btape: btape.c:612-0 Wrote 1 EOF to "Drive1" (/dev/nsa0)
> btape: btape.c:858-0 Backspaced over EOF OK.
> btape: btape.c:863-0 Backspace record OK.
> btape: btape.c:880-0 
> Block re-read correct. Test succeeded!
> === End Write, backup, and re-read test ===
> 
> 
> 
> === Forward space files test ===
> 
> This test is essential to Bacula.
> 
> I'm going to write five files then test forward spacing
> 
> btape: btape.c:582-0 Rewound "Drive1" (/dev/nsa0)
> btape: btape.c:1917-0 Wrote one record of 64412 bytes.
> btape: btape.c:1919-0 Wrote block to device.
> btape: btape.c:612-0 Wrote 1 EOF to "Drive1" (/dev/nsa0)
> btape: btape.c:1917-0 Wrote one record of 64412 bytes.
> btape: btape.c:1919-0 Wrote block to device.
> btape: btape.c:1917-0 Wrote one record of 64412 bytes.
> btape: btape.c:1919-0 Wrote block to device.
> btape: btape.c:612-0 Wrote 1 EOF to "Drive1" (/dev/nsa0)
> btape: btape.c:1917-0 Wrote one record of 64412 bytes.
> btape: btape.c:1919-0 Wrote block to device.
> btape: btape.c:1917-0 Wrote one record of 64412 bytes.
> btape: btape.c:1919-0 Wrote block to device.
> btape: btape.c:1917-0 Wrote one record of 64412 bytes.
> btape: btape.c:1919-0 Wrote block to device.
> btape: btape.c:612-0 Wrote 1 EOF to "Drive1" (/dev/nsa0)
> btape: btape.c:1917-0 Wrote one record of 64412 bytes.
> btape: btape.c:1919-0 Wrote block to device.
> btape: btape.c:1917-0 Wrote one record of 64412 bytes.
> btape: btape.c:1919-0 Wrote block to device.
> btape: btape.c:612-0 Wrote 1 EOF to "Drive1" (/dev/nsa0)
> btape: btape.c:1917-0 Wrote one record of 64412 bytes.
> btape: btape.c:1919-0 Wrote block to device.
> btape: btape.c:612-0 Wrote 1 EOF to "Drive1" (/dev/nsa0)
> btape: btape.c:582-0 Rewound "Drive1" (/dev/nsa0)
> btape: btape.c:1644-0 Now forward spacing 1 file.
> We should be in file 1. I am at file 1. This is correct!
> btape: btape.c:1656-0 Now forward spacing 2 files.
> We should be in file 3. I am at file 3. This is correct!
> btape: btape.c:582-0 Rewound "Drive1" (/dev/nsa0)
> btape: btape.c:1669-0 Now forward spacing 4 files.
> We should be in file 4. I am at file 4. This is correct!
> 
> btape: btape.c:1687-0 Now forward spacing 1 more file.
> We should be in file 5. I am at file 5. This is correct!
> 
> === End Forward space files test ===
> 
> *quit
> 
> Now I edited bacula-sd.conf to add the auto changer stuff.
> 
> # cat 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 = "RqVUSRtYt7yf6uKU5BaLKwRmfRZ8fzGSFnW85jhJ2E8p3"
> }
> 
> #
> # Devices supported by this Storage daemon
> # To connect, the Director's bacula-dir.conf must have the
> #  same Name and MediaType.
> #
> 
> #
> # Define a Virtual autochanger
> #
> Autochanger {
>   Name = FileChgr1
>   Device = FileChgr1-Dev1, FileChgr1-Dev2
>   Changer Command = ""
>   Changer Device = /dev/null
> }
> 
> Device {
>   Name = FileChgr1-Dev1
>   Media Type = File1
>   Archive Device = /backups
>   LabelMedia = yes;                   # lets Bacula label unlabeled media
>   Random Access = Yes;
>   AutomaticMount = yes;               # when device opened, read it
>   RemovableMedia = no;
>   AlwaysOpen = no;
>   Maximum Concurrent Jobs = 5
> }
> 
> Device {
>   Name = FileChgr1-Dev2
>   Media Type = File1
>   Archive Device = /backups
>   LabelMedia = yes;                   # lets Bacula label unlabeled media
>   Random Access = Yes;
>   AutomaticMount = yes;               # when device opened, read it
>   RemovableMedia = no;
>   AlwaysOpen = no;
>   Maximum Concurrent Jobs = 5
> }
> 
> #
> # 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
> }

Yes, use the pass device for the changers


> 
> Device {
>   Name = "Drive1"
>   Media Type = LTO-4
> #  Archive Device = /dev/pass41
>   Archive Device = /dev/nsa0
>   AutomaticMount = yes;               # when device opened, read it
>   AlwaysOpen = yes;
>   RemovableMedia = yes;
>   RandomAccess = no;
>   Maximum File Size = 5GB
>   Changer Command = "/usr/local/etc/bacula/mtx-changer %c %o %S %a %d"
>   Changer Device = /dev/pass42
>   AutoChanger = yes
>  # Enable the Alert command only if you have the mtx package loaded
> #Alert Command = "sh -c 'tapeinfo -f %c |grep TapeAlert|cat'"
>  # If you have smartctl, enable this, it has more info than tapeinfo
> #Alert Command = "sh -c 'smartctl -H -l error %c'"
> }
> 
> #
> # Send all messages to the Director,
> # mount messages also are sent to the email address
> #
> Messages {
>   Name = Standard
>   director = core-prod-bkp-3.ucsc.edu-dir = all
> }
> 
> # 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.

> mtx: Request Sense: Long Report=yes
> mtx: Request Sense: Valid Residual=no
> mtx: Request Sense: Error Code=0 (Unknown?!)
> mtx: Request Sense: Sense Key=No Sense
> mtx: Request Sense: FileMark=no
> mtx: Request Sense: EOM=no
> mtx: Request Sense: ILI=no
> mtx: Request Sense: Additional Sense Code = 00
> mtx: Request Sense: Additional Sense Qualifier = 00
> mtx: Request Sense: BPV=no
> mtx: Request Sense: Error in CDB=no
> mtx: Request Sense: SKSV=no
> Mode sense (0x1A) for Page 0x1D failed
> mtx: Request Sense: Long Report=yes
> mtx: Request Sense: Valid Residual=no
> mtx: Request Sense: Error Code=0 (Unknown?!)
> mtx: Request Sense: Sense Key=No Sense
> mtx: Request Sense: FileMark=no
> mtx: Request Sense: EOM=no
> mtx: Request Sense: ILI=no
> mtx: Request Sense: Additional Sense Code = 00
> mtx: Request Sense: Additional Sense Qualifier = 00
> mtx: Request Sense: BPV=no
> mtx: Request Sense: Error in CDB=no
> mtx: Request Sense: SKSV=no
> READ ELEMENT STATUS Command Failed
> 30-Jan 19:08 btape JobId 0: 3991 Bad autochanger "loaded? drive 0" command: 
> ERR=Child exited with code 1.
> Results=RequestSense (0x03) failed
> mtx: Request Sense: Long Report=yes
> mtx: Request Sense: Valid Residual=no
> mtx: Request Sense: Error Code=0 (Unknown?!)
> mtx: Request Sense: Sense Key=No Sense
> mtx: Request Sense: FileMark=no
> mtx: Request Sense: EOM=no
> mtx: Request Sense: ILI=no
> mtx: Request Sense: Additional Sense Code = 00
> mtx: Request Sense: Additional Sense Qualifier = 00
> mtx: Request Sense: BPV=no
> mtx: Request Sense: Error in CDB=no
> mtx: Request Sense: SKSV=no
> Mode sense (0x1A) for Page 0x1D failed
> mtx: Request Sense: Long Report=yes
> mtx: Request Sense: Valid Residual=no
> mtx: Request Sense: Error Code=0 (Unknown?!)
> mtx: Request Sense: Sense Key=No Sense
> mtx: Request Sense: FileMark=no
> mtx: Request Sense: EOM=no
> mtx: Request Sense: ILI=no
> mtx: Request Sense: Additional Sense Code = 00
> mtx: Request Sense: Additional Sense Qualifier = 00
> mtx: Request Sense: BPV=no
> mtx: Request Sense: Error in CDB=no
> mtx: Request Sense: SKSV=no
> READ ELEMENT STATUS Command Failed
> 
> btape: autochanger.c:314-0 Error: autochanger loaded? drive 0 ERR=Child 
> exited with code 1.
> Results=RequestSense (0x03) failed
> mtx: Request Sense: Long Report=yes
> mtx: Request Sense: Valid Residual=no
> mtx: Request Sense: Error Code=0 (Unknown?!)
> mtx: Request Sense: Sense Key=No Sense
> mtx: Request Sense: FileMark=no
> mtx: Request Sense: EOM=no
> mtx: Request Sense: ILI=no
> mtx: Request Sense: Additional Sense Code = 00
> mtx: Request Sense: Additional Sense Qualifier = 00
> mtx: Request Sense: BPV=no
> mtx: Request Sense: Error in CDB=no
> mtx: Request Sense: SKSV=no
> Mode sense (0x1A) for Page 0x1D failed
> mtx: Request Sense: Long Report=yes
> mtx: Request Sense: Valid Residual=no
> mtx: Request Sense: Error Code=0 (Unknown?!)
> mtx: Request Sense: Sense Key=No Sense
> mtx: Request Sense: FileMark=no
> mtx: Request Sense: EOM=no
> mtx: Request Sense: ILI=no
> mtx: Request Sense: Additional Sense Code = 00
> mtx: Request Sense: Additional Sense Qualifier = 00
> mtx: Request Sense: BPV=no
> mtx: Request Sense: Error in CDB=no
> mtx: Request Sense: SKSV=no
> READ ELEMENT STATUS Command Failed
> 
> btape: autochanger.c:342-0 Unlocking changer core-prod-jb-2
> 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=mtx: Request Sense: 
> Long Report=yes
> mtx: Request Sense: Valid Residual=no
> mtx: Request Sense: Error Code=0 (Unknown?!)
> mtx: Request Sense: Sense Key=No Sense
> mtx: Request Sense: FileMark=no
> mtx: Request Sense: EOM=no
> mtx: Request Sense: ILI=no
> mtx: Request Sense: Additional Sense Code = 00
> mtx: Request Sense: Additional Sense Qualifier = 00
> mtx: Request Sense: BPV=no
> mtx: Request Sense: Error in CDB=no
> mtx: Request Sense: SKSV=no
> INQUIRY command Failed
> 30-Jan 19:08 btape JobId 0: 3991 Bad autochanger "loaded? drive 0" command: 
> ERR=Child exited with code 1.
> Results=mtx: Request Sense: Long Report=yes
> mtx: Request Sense: Valid Residual=no
> mtx: Request Sense: Error Code=0 (Unknown?!)
> mtx: Request Sense: Sense Key=No Sense
> mtx: Request Sense: FileMark=no
> mtx: Request Sense: EOM=no
> mtx: Request Sense: ILI=no
> mtx: Request Sense: Additional Sense Code = 00
> mtx: Request Sense: Additional Sense Qualifier = 00
> mtx: Request Sense: BPV=no
> mtx: Request Sense: Error in CDB=no
> mtx: Request Sense: SKSV=no
> INQUIRY command Failed
> 
> btape: autochanger.c:314-0 Error: autochanger loaded? drive 0 ERR=Child 
> exited with code 1.
> Results=mtx: Request Sense: Long Report=yes
> mtx: Request Sense: Valid Residual=no
> mtx: Request Sense: Error Code=0 (Unknown?!)
> mtx: Request Sense: Sense Key=No Sense
> mtx: Request Sense: FileMark=no
> mtx: Request Sense: EOM=no
> mtx: Request Sense: ILI=no
> mtx: Request Sense: Additional Sense Code = 00
> mtx: Request Sense: Additional Sense Qualifier = 00
> mtx: Request Sense: BPV=no
> mtx: Request Sense: Error in CDB=no
> mtx: Request Sense: SKSV=no
> INQUIRY command Failed
> 
> btape: autochanger.c:342-0 Unlocking changer core-prod-jb-2
> btape: btape.c:478-0 open device "Drive1" (/dev/nsa0): OK
> *test
> 
> === Write, rewind, and re-read test ===
> 
> I'm going to write 10000 records and an EOF
> then write 10000 records and an EOF, then rewind,
> and re-read the data to verify that it is correct.
> 
> This is an *essential* feature ...
> 
> btape: btape.c:1161-0 Wrote 10000 blocks of 64412 bytes.
> btape: btape.c:612-0 Wrote 1 EOF to "Drive1" (/dev/nsa0)
> btape: btape.c:1177-0 Wrote 10000 blocks of 64412 bytes.
> btape: btape.c:612-0 Wrote 1 EOF to "Drive1" (/dev/nsa0)
> btape: btape.c:1219-0 Rewind OK.
> 10000 blocks re-read correctly.
> Got EOF on tape.
> 10000 blocks re-read correctly.
> === Test Succeeded. End Write, rewind, and re-read test ===
> 
> btape: btape.c:1286-0 Block position test
> btape: btape.c:1297-0 Rewind OK.
> Reposition to file:block 0:4
> Block 5 re-read correctly.
> Reposition to file:block 0:200
> Block 201 re-read correctly.
> Reposition to file:block 0:9999
> Block 10000 re-read correctly.
> Reposition to file:block 1:0
> Block 10001 re-read correctly.
> Reposition to file:block 1:600
> Block 10601 re-read correctly.
> Reposition to file:block 1:9999
> Block 20000 re-read correctly.
> === Test Succeeded. End Write, rewind, and re-read test ===
> 
> 
> 
> === Append files test ===
> 
> This test is essential to Bacula.
> 
> I'm going to write one record  in file 0,
>                    two records in file 1,
>              and three records in file 2
> 
> btape: btape.c:582-0 Rewound "Drive1" (/dev/nsa0)
> btape: btape.c:1917-0 Wrote one record of 64412 bytes.
> btape: btape.c:1919-0 Wrote block to device.
> btape: btape.c:612-0 Wrote 1 EOF to "Drive1" (/dev/nsa0)
> btape: btape.c:1917-0 Wrote one record of 64412 bytes.
> btape: btape.c:1919-0 Wrote block to device.
> btape: btape.c:1917-0 Wrote one record of 64412 bytes.
> btape: btape.c:1919-0 Wrote block to device.
> btape: btape.c:612-0 Wrote 1 EOF to "Drive1" (/dev/nsa0)
> btape: btape.c:1917-0 Wrote one record of 64412 bytes.
> btape: btape.c:1919-0 Wrote block to device.
> btape: btape.c:1917-0 Wrote one record of 64412 bytes.
> btape: btape.c:1919-0 Wrote block to device.
> btape: btape.c:1917-0 Wrote one record of 64412 bytes.
> btape: btape.c:1919-0 Wrote block to device.
> btape: btape.c:612-0 Wrote 1 EOF to "Drive1" (/dev/nsa0)
> btape: dev.c:271-0 close_dev vol= fd=3 dev=802c6bc28 adata=0 dev="Drive1" 
> (/dev/nsa0)
> btape: autochanger.c:328-0 Locking changer core-prod-jb-2
> 30-Jan 19:12 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=mtx: Request Sense: 
> Long Report=yes
> mtx: Request Sense: Valid Residual=no
> mtx: Request Sense: Error Code=0 (Unknown?!)
> mtx: Request Sense: Sense Key=No Sense
> mtx: Request Sense: FileMark=no
> mtx: Request Sense: EOM=no
> mtx: Request Sense: ILI=no
> mtx: Request Sense: Additional Sense Code = 00
> mtx: Request Sense: Additional Sense Qualifier = 00
> mtx: Request Sense: BPV=no
> mtx: Request Sense: Error in CDB=no
> mtx: Request Sense: SKSV=no
> INQUIRY command Failed
> 30-Jan 19:12 btape JobId 0: 3991 Bad autochanger "loaded? drive 0" command: 
> ERR=Child exited with code 1.
> Results=mtx: Request Sense: Long Report=yes
> mtx: Request Sense: Valid Residual=no
> mtx: Request Sense: Error Code=0 (Unknown?!)
> mtx: Request Sense: Sense Key=No Sense
> mtx: Request Sense: FileMark=no
> mtx: Request Sense: EOM=no
> mtx: Request Sense: ILI=no
> mtx: Request Sense: Additional Sense Code = 00
> mtx: Request Sense: Additional Sense Qualifier = 00
> mtx: Request Sense: BPV=no
> mtx: Request Sense: Error in CDB=no
> mtx: Request Sense: SKSV=no
> INQUIRY command Failed
> 
> btape: autochanger.c:314-0 Error: autochanger loaded? drive 0 ERR=Child 
> exited with code 1.
> Results=mtx: Request Sense: Long Report=yes
> mtx: Request Sense: Valid Residual=no
> mtx: Request Sense: Error Code=0 (Unknown?!)
> mtx: Request Sense: Sense Key=No Sense
> mtx: Request Sense: FileMark=no
> mtx: Request Sense: EOM=no
> mtx: Request Sense: ILI=no
> mtx: Request Sense: Additional Sense Code = 00
> mtx: Request Sense: Additional Sense Qualifier = 00
> mtx: Request Sense: BPV=no
> mtx: Request Sense: Error in CDB=no
> mtx: Request Sense: SKSV=no
> INQUIRY command Failed
> 
> btape: autochanger.c:342-0 Unlocking changer core-prod-jb-2
> btape: btape.c:478-0 open device "Drive1" (/dev/nsa0): OK
> btape: btape.c:582-0 Rewound "Drive1" (/dev/nsa0)
> btape: btape.c:1430-0 Now moving to end of medium.
> btape: btape.c:633-0 Moved to end of medium.
> We should be in file 3. I am at file 3. This is correct!
> 
> Now the important part, I am going to attempt to append to the tape.
> 
> btape: btape.c:1917-0 Wrote one record of 64412 bytes.
> btape: btape.c:1919-0 Wrote block to device.
> btape: btape.c:612-0 Wrote 1 EOF to "Drive1" (/dev/nsa0)
> btape: btape.c:582-0 Rewound "Drive1" (/dev/nsa0)
> Done appending, there should be no I/O errors
> 
> Doing Bacula scan of blocks:
> Block=19999 file,blk=0,1 blen=64448 First rec FI=0 SessId=0 SessTim=0 Strm=0 
> rlen=64412
> 1 block of 64448 bytes in file 1
> End of File mark.
> Block=20000 file,blk=1,1 blen=64448 First rec FI=0 SessId=0 SessTim=0 Strm=0 
> rlen=64412
> Block=20001 file,blk=1,2 blen=64448 First rec FI=0 SessId=0 SessTim=0 Strm=0 
> rlen=64412
> 2 blocks of 64448 bytes in file 2
> End of File mark.
> Block=20002 file,blk=2,1 blen=64448 First rec FI=0 SessId=0 SessTim=0 Strm=0 
> rlen=64412
> Block=20003 file,blk=2,2 blen=64448 First rec FI=0 SessId=0 SessTim=0 Strm=0 
> rlen=64412
> Block=20004 file,blk=2,3 blen=64448 First rec FI=0 SessId=0 SessTim=0 Strm=0 
> rlen=64412
> 3 blocks of 64448 bytes in file 3
> End of File mark.
> Block=20005 file,blk=3,1 blen=64448 First rec FI=0 SessId=0 SessTim=0 Strm=0 
> rlen=64412
> 1 block of 64448 bytes in file 4
> End of File mark.
> Total files=4, blocks=7, bytes = 451,136
> End scanning the tape.
> We should be in file 4. I am at file 4. This is correct!
> 
> The above Bacula scan should have output identical to what follows.
> Please double check it ...
> === Sample correct output ===
> 1 block of 64448 bytes in file 1
> End of File mark.
> 2 blocks of 64448 bytes in file 2
> End of File mark.
> 3 blocks of 64448 bytes in file 3
> End of File mark.
> 1 block of 64448 bytes in file 4
> End of File mark.
> Total files=4, blocks=7, bytes = 451,136
> === End sample correct output ===
> 
> If the above scan output is not identical to the
> sample output, you MUST correct the problem
> or Bacula will not be able to write multiple Jobs to 
> the tape.
> 
> 
> === Write, backup, and re-read test ===
> 
> I'm going to write three records and an EOF
> then backup over the EOF and re-read the last record.
> Bacula does this after writing the last block on the
> tape to verify that the block was written correctly.
> 
> This is not an *essential* feature ...
> 
> btape: btape.c:582-0 Rewound "Drive1" (/dev/nsa0)
> btape: btape.c:820-0 Wrote first record of 64412 bytes.
> btape: btape.c:831-0 Wrote second record of 64412 bytes.
> btape: btape.c:842-0 Wrote third record of 64412 bytes.
> btape: btape.c:612-0 Wrote 1 EOF to "Drive1" (/dev/nsa0)
> btape: btape.c:858-0 Backspaced over EOF OK.
> btape: btape.c:863-0 Backspace record OK.
> btape: btape.c:880-0 
> Block re-read correct. Test succeeded!
> === End Write, backup, and re-read test ===
> 
> 
> 
> === Forward space files test ===
> 
> This test is essential to Bacula.
> 
> I'm going to write five files then test forward spacing
> 
> btape: btape.c:582-0 Rewound "Drive1" (/dev/nsa0)
> btape: btape.c:1917-0 Wrote one record of 64412 bytes.
> btape: btape.c:1919-0 Wrote block to device.
> btape: btape.c:612-0 Wrote 1 EOF to "Drive1" (/dev/nsa0)
> btape: btape.c:1917-0 Wrote one record of 64412 bytes.
> btape: btape.c:1919-0 Wrote block to device.
> btape: btape.c:1917-0 Wrote one record of 64412 bytes.
> btape: btape.c:1919-0 Wrote block to device.
> btape: btape.c:612-0 Wrote 1 EOF to "Drive1" (/dev/nsa0)
> btape: btape.c:1917-0 Wrote one record of 64412 bytes.
> btape: btape.c:1919-0 Wrote block to device.
> btape: btape.c:1917-0 Wrote one record of 64412 bytes.
> btape: btape.c:1919-0 Wrote block to device.
> btape: btape.c:1917-0 Wrote one record of 64412 bytes.
> btape: btape.c:1919-0 Wrote block to device.
> btape: btape.c:612-0 Wrote 1 EOF to "Drive1" (/dev/nsa0)
> btape: btape.c:1917-0 Wrote one record of 64412 bytes.
> btape: btape.c:1919-0 Wrote block to device.
> btape: btape.c:1917-0 Wrote one record of 64412 bytes.
> btape: btape.c:1919-0 Wrote block to device.
> btape: btape.c:612-0 Wrote 1 EOF to "Drive1" (/dev/nsa0)
> btape: btape.c:1917-0 Wrote one record of 64412 bytes.
> btape: btape.c:1919-0 Wrote block to device.
> btape: btape.c:612-0 Wrote 1 EOF to "Drive1" (/dev/nsa0)
> btape: btape.c:582-0 Rewound "Drive1" (/dev/nsa0)
> btape: btape.c:1644-0 Now forward spacing 1 file.
> We should be in file 1. I am at file 1. This is correct!
> btape: btape.c:1656-0 Now forward spacing 2 files.
> We should be in file 3. I am at file 3. This is correct!
> btape: btape.c:582-0 Rewound "Drive1" (/dev/nsa0)
> btape: btape.c:1669-0 Now forward spacing 4 files.
> We should be in file 4. I am at file 4. This is correct!
> 
> btape: btape.c:1687-0 Now forward spacing 1 more file.
> We should be in file 5. I am at file 5. This is correct!
> 
> === End Forward space files test ===
> 
> 
> Ah, I see you have an autochanger configured.
> To test the autochanger you must have a blank tape
>  that I can write on in Slot 1.
> 
> Do you wish to continue with the Autochanger test? (y/n): y
> 
> 
> === Autochanger test ===
> 
> 3301 Issuing autochanger "loaded" command.
> 3991 Bad autochanger command: /usr/local/etc/bacula/mtx-changer /dev/pass42 
> loaded 1 /dev/nsa0 0
> 3991 result="mtx: Request Sense: Long Report=yes
> ": ERR=Child exited with code 1
> You must correct this error or the Autochanger will not work.
> *quit
> btape: dev.c:271-0 close_dev vol= fd=3 dev=802c6bc28 adata=0 dev="Drive1" 
> (/dev/nsa0)
> Pool   Maxsize  Maxused  Inuse
> NoPool      256        8      0
> NAME        130        0      0
> FNAME       256       11      0
> MSG       64512        4      0
> EMSG       1024        3      0
> BSOCK      4096        0      0
> 
> # /usr/local/etc/bacula/mtx-changer /dev/pass42 loaded 1 /dev/nsa0 0
> mtx: Request Sense: Long Report=yes
> mtx: Request Sense: Valid Residual=no
> mtx: Request Sense: Error Code=0 (Unknown?!)
> mtx: Request Sense: Sense Key=No Sense
> mtx: Request Sense: FileMark=no
> mtx: Request Sense: EOM=no
> mtx: Request Sense: ILI=no
> mtx: Request Sense: Additional Sense Code = 00
> mtx: Request Sense: Additional Sense Qualifier = 00
> mtx: Request Sense: BPV=no
> mtx: Request Sense: Error in CDB=no
> mtx: Request Sense: SKSV=no
> INQUIRY command Failed
> 
> The FreeBSD version of mtx also fails. 
> 
> # /usr/local/sbin/mtx -f /dev/pass42 inquiry
> mtx: Request Sense: Long Report=yes
> mtx: Request Sense: Valid Residual=no
> mtx: Request Sense: Error Code=0 (Unknown?!)
> mtx: Request Sense: Sense Key=No Sense
> mtx: Request Sense: FileMark=no
> mtx: Request Sense: EOM=no
> mtx: Request Sense: ILI=no
> mtx: Request Sense: Additional Sense Code = 00
> mtx: Request Sense: Additional Sense Qualifier = 00
> mtx: Request Sense: BPV=no
> mtx: Request Sense: Error in CDB=no
> mtx: Request Sense: SKSV=no
> INQUIRY Command Failed
> # /usr/local/sbin/mtx -f /dev/pass42 status
> mtx: Request Sense: Long Report=yes
> mtx: Request Sense: Valid Residual=no
> mtx: Request Sense: Error Code=0 (Unknown?!)
> mtx: Request Sense: Sense Key=No Sense
> mtx: Request Sense: FileMark=no
> mtx: Request Sense: EOM=no
> mtx: Request Sense: ILI=no
> mtx: Request Sense: Additional Sense Code = 00
> mtx: Request Sense: Additional Sense Qualifier = 00
> mtx: Request Sense: BPV=no
> mtx: Request Sense: Error in CDB=no
> mtx: Request Sense: SKSV=no
> INQUIRY command Failed
> 
> 
> And using /dev/ch0 instead of /dev/pass42 doesn’t seem to help.
> 
> # /usr/local/sbin/mtx -f /dev/ch0 status
> cannot open SCSI device '/dev/ch0' - Input/output error
> 
> # /usr/local/etc/bacula/mtx-changer /dev/ch0 loaded 1 /dev/nsa0 0
> cannot open SCSI device '/dev/ch0' - Input/output error

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&searchsubmit=

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




------------------------------------------------------------------------------
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

Reply via email to