Dear Martin,

Sorry for the delay, but I wanted to get a "fresh tape", but I ended up 
removing one from my library with 35 tapes (all in use by bacula). After using 
the correct "query.sql" I was able to identify a possible tape.

So I ran btape and it did not report any problem (see below)

I will also attach my bacula-sd.conf. Do you need any other configuration files?

The currently used bacula version is 9.6.3 (09 March 2020) installed via the 
Debian-Servers (testing).

Best,

Christian

Btape report:

srv-fs-de1:/etc/bacula# btape /dev/nst0 -v
Tape block granularity is 1024 bytes.
btape: butil.c:290-0 Using device: "/dev/nst0" for writing.
btape: btape.c:478-0 open device "LTO-5" (/dev/nst0): 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 "LTO-5" (/dev/nst0)
btape: btape.c:1177-0 Wrote 10000 blocks of 64412 bytes.
btape: btape.c:612-0 Wrote 1 EOF to "LTO-5" (/dev/nst0)
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 "LTO-5" (/dev/nst0)
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 "LTO-5" (/dev/nst0)
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 "LTO-5" (/dev/nst0)
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 "LTO-5" (/dev/nst0)
btape: btape.c:478-0 open device "LTO-5" (/dev/nst0): OK
btape: btape.c:582-0 Rewound "LTO-5" (/dev/nst0)
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 "LTO-5" (/dev/nst0)
btape: btape.c:582-0 Rewound "LTO-5" (/dev/nst0)
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 "LTO-5" (/dev/nst0)
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 "LTO-5" (/dev/nst0)
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 "LTO-5" (/dev/nst0)
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 "LTO-5" (/dev/nst0)
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 "LTO-5" (/dev/nst0)
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 "LTO-5" (/dev/nst0)
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 "LTO-5" (/dev/nst0)
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 "LTO-5" (/dev/nst0)
btape: btape.c:582-0 Rewound "LTO-5" (/dev/nst0)
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 "LTO-5" (/dev/nst0)
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 ===



Output lsscsi --verbose


[0:2:0:0]    disk    LSI      MR9280-16i4e     2.13  /dev/sdb
  dir: /sys/bus/scsi/devices/0:2:0:0  
[/sys/devices/pci0000:00/0000:00:01.1/0000:02:00.0/host0/target0:2:0/0:2:0:0]
[0:2:1:0]    disk    LSI      MR9280-16i4e     2.13  /dev/sda
  dir: /sys/bus/scsi/devices/0:2:1:0  
[/sys/devices/pci0000:00/0000:00:01.1/0000:02:00.0/host0/target0:2:1/0:2:1:0]
[1:0:0:0]    disk    ATA      Samsung SSD 850  2B6Q  /dev/sdc
  dir: /sys/bus/scsi/devices/1:0:0:0  
[/sys/devices/pci0000:00/0000:00:1f.2/ata1/host1/target1:0:0/1:0:0:0]
[9:0:4:0]    tape    TANDBERG LTO-5 HH         Z629  /dev/st0
  dir: /sys/bus/scsi/devices/9:0:4:0  
[/sys/devices/pci0000:00/0000:00:1c.0/0000:03:00.0/host9/target9:0:4/9:0:4:0]
[9:2:0:0]    disk    LSI      MR9240-4i        2.13  /dev/sdd
  dir: /sys/bus/scsi/devices/9:2:0:0  
[/sys/devices/pci0000:00/0000:00:1c.0/0000:03:00.0/host9/target9:2:0/9:2:0:0]
list_ndevices: scandir: /sys/class/nvme/: No such file or directory
NVMe module may not be loaded

stinit.def (but I am not sure, if this file and its configuration is really 
applied)

# This file contains example definitions for different kinds of tape
# devices.
#
# You can find some examples in /usr/share/doc/mt-st/examples.
#
# Common definitions to be applied to all tape devices
# (This is the driver's default)
{buffer-writes read-ahead async-writes}
manufacturer="TANDBERG" model="LTO-5 HH" "Z519"
{
scsi2logical=1
can-bsr=1
auto-lock=0
two-fms=0
drive-buffering=1
buffer-writes
read-ahead=1
async-writes=1
can-partitions=1
#???fast-mteom=1
fast-eom=1
#timeout=180
#long-timeout=11400
mode1 blocksize=0 density=0x58 compression=1 # native
mode2 blocksize=0 density=0x58 compression=0 # LTO
}



Output  mt -f /dev/st0 status

SCSI 2 tape drive:
File number=0, block number=0, partition=0.
Tape block size 0 bytes. Density code 0x58 (LTO-5).
Soft error count since last status=0
General status bits on (41010000):
 BOT ONLINE IM_REP_EN


Bacula-sd.conf


#
# Default Bacula Storage Daemon Configuration file
#
#  For Bacula release 5.2.3 (16 December 2011) -- debian 6.0.3
#
# 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.
#

Storage {                             # definition of myself
  Name = fritzie15-sd
  SDPort = 9103                  # Director's port      
  WorkingDirectory = "/var/lib/bacula"
  Pid Directory = "/var/run"
  Maximum Concurrent Jobs = 20
 
  SDAddress = SOME-IPV4-ADRESS
}

#
# List Directors who are permitted to contact Storage daemon
#
Director {
  Name = fritzie15-dir
  Password = SOME_VERY_SAFE_PASSWORD
}

#
# Note, for a list of additional Device templates please
#  see the directory <bacula-source>/examples/devices
# Or follow the following link:
#  
http://bacula.svn.sourceforge.net/viewvc/bacula/trunk/bacula/examples/devices/
#

#
# Devices supported by this Storage daemon
# To connect, the Director's bacula-dir.conf must have the
#  same Name and MediaType. 
#

Device {
  Name = FileStorage
  Media Type = File
  Archive Device = SOME_PATH
  LabelMedia = yes;                   # lets Bacula label unlabeled media
  Random Access = Yes;
  AutomaticMount = yes;               # when device opened, read it
  RemovableMedia = no;
  AlwaysOpen = no;
  Maximum Volume Size = 100G;
  Maximum Concurrent Jobs = 2
}

Device {
  Name = LTO-5
  Archive Device = /dev/nst0
  Device Type = Tape
  Media Type = LTO-5
  LabelMedia = yes
  Random Access = no
  AutomaticMount = yes
  RemovableMedia = yes
  AlwaysOpen = yes
  Maximum Concurrent Jobs = 1
  LabelMedia = yes
  Maximum File Size = 400G
  Maximum Changer Wait = 2h
  Volume Poll Interval = 5 min
  Offline on Unmount = yes
  Spool Directory = /srv/ag_dudziak/bacula-spool
#  Maximum Block Size = 256K
}

Messages {
  Name = Standard
  director = fritzie15-dir = all
}


-----Ursprüngliche Nachricht-----
Von: Martin Simmons <mar...@lispworks.com> 
Gesendet: Dienstag, 12. Mai 2020 20:17
An: Christian Lehmann <lcompu...@t-online.de>
Cc: bacula-users@lists.sourceforge.net
Betreff: Re: AW: [Bacula-users] Tape Moving Error after server restart

It could be a problem with the driver or the Bacula config.

Have you tried running the btape test command recently?  See
https://www.bacula.org/9.6.x-manuals/en/problems/Testing_Your_Tape_Drive_Wit.html#SECTION00420000000000000000

__Martin


>>>>> On Fri, 8 May 2020 09:25:26 +0200 (CEST), Christian Lehmann said:
> 
> Hi Martin,
> 
> I just tested the umount/eject/run/mount procedure without a restart in 
> between - and the same happens:
> 
> *umount LTO-5HH
> Automatically selected Catalog: Fritzie18-Cat Using Catalog 
> "Fritzie18-Cat"
> 3002 Device ""LTO-5" (/dev/nst0)" unmounted.
> *run
> A job name must be specified.
> The defined Job resources are:
>      1: Bacula Catalog
>      2: Bacula Catalog Restore
>      3: Gruppen-LW ohne Chris LTO-5
>      4: ...
> Select Job resource (1-10): 1
> Run Backup job
> JobName:  Bacula Catalog
> Level:    Full
> Client:   fritzie15-fd
> FileSet:  Catalog
> Pool:     LTO-5HH-Pool (From Job resource)
> Storage:  LTO-5HH (From Job resource)
> When:     2020-05-08 09:18:01
> Priority: 11
> OK to run? (yes/mod/no): yes
> Job queued. JobId=12628
> 
> *mount LTO-5HH
> 3001 Mounted Volume: LTO-5-Tape0017
> 3001 Device ""LTO-5" (/dev/nst0)" is mounted with Volume "LTO-5-Tape0017"
> 
> 08-Mai 09:18 fritzie15-dir JobId 12628: shell command: run BeforeJob 
> "/etc/bacula/make_catalog_backup bacula bacula SockenC7"
> 08-Mai 09:18 fritzie15-dir JobId 12628: Start Backup JobId 12628, 
> Job=Bacula_Catalog.2020-05-08_09.18.07_51
> 08-Mai 09:19 fritzie15-dir JobId 12628: Using Device "LTO-5" to write.
> 08-Mai 09:19 fritzie15-sd JobId 12628: Volume "LTO-5-Tape0017" previously 
> written, moving to end of data.
> 08-Mai 09:19 fritzie15-sd JobId 12628: Error: Unable to position to end of 
> data on Tape device "LTO-5" (/dev/nst0): ERR=tape_dev.c:363 ioctl MTIOCGET 
> error on "LTO-5" (/dev/nst0). ERR=Erfolg.
> 
> 08-Mai 09:19 fritzie15-sd JobId 12628: Marking Volume "LTO-5-Tape0017" 
> in Error in Catalog
> 
> So it seems not to be connected to a reset of the device.
> 
> Thank you very much for your kind assistance,
> 
> Christian
> 
> -----Original-Nachricht-----
> Betreff: Re: [Bacula-users] Tape Moving Error after server restart
> Datum: 2020-05-08T07:05:36+0200
> Von: "Christian Lehmann" <lcompu...@t-online.de>
> An: "Martin Simmons" <mar...@lispworks.com>
> 
> Dear Martin,
> 
> I am sorry for answering so late, but due to the COVID-19/Sars-CoV2 situation 
> I had a lot of other issues to solve.
> 
> During the restart no backup was running - just the tape was positioned in 
> the middle of the tape.
> 
> I will test the unmounr/eject/mount procedure without a reboot today and 
> report the results.
> 
> Best,
> 
> Christian
> 
> 
> 
> -----Original-Nachricht-----
> Betreff: Re: [Bacula-users] Tape Moving Error after server restart
> Datum: 2020-03-20T16:19:57+0100
> Von: "Martin Simmons" <mar...@lispworks.com>
> An: "Christian Lehmann" <lcompu...@t-online.de>
> 
> Did the restart happen in the middle of a backup?
> 
> Does the backup error occur after you unmount the tape from bconole, 
> eject it and then insert and mount it again, without rebooting?
> 
> __Martin
> 
> 
>>>>> On Wed, 18 Mar 2020 13:52:09 +0100 (CET), Christian Lehmann said:
> > 
> > Dear all,
> >  
> > from time to time I get an error after I restart the server running 
> > my bacula director and also a storage daemon with an Tandberg LTO-5 HH.
> >  
> > The current bacula version is 9.6.3 (9th March 2020) on a Debian machine.
> >  
> > The situation is:
> >  
> > Bacula has made some backups to a tape in the drive, but the tape 
> > isn't full yet.
> >  
> > Than a restart of the machine is happing (for example due to a 
> > Kernel update). So bacula is shutting down and the tape is rewinded.
> >  
> > After restart, as soon as I initiate a backup job, bacula tries the 
> > positioning to the end of the tape to write the data (in this case I 
> > just run a small backup job of my bacula database).
> >  
> > However, he fails to do so, with the error "ERFOLG" (which is German 
> > and means SUCCESS). So I do not understand what is happening there. 
> > Has someone come accross such a behaviour?
> >  
> > 18-Mär 13:19 fritzie15-dir JobId 12352: shell command: run BeforeJob 
> > "/etc/bacula/make_catalog_backup bacula bacula VERY_SAFE_PASSWORD_XXX"
> > 18-Mär 13:19 fritzie15-dir JobId 12352: Start Backup JobId 12352,
> > Job=Bacula_Catalog.2020-03-18_13.19.09_03
> > 18-Mär 13:19 fritzie15-dir JobId 12352: Using Device "LTO-5" to write.
> > 18-Mär 13:19 fritzie15-sd JobId 12352: Volume "LTO-5-Tape0027" 
> > previously written, moving to end of data.
> > 18-Mär 13:20 fritzie15-sd JobId 12352: Error: Unable to position to 
> > end of data on Tape device "LTO-5" (/dev/nst0): ERR=tape_dev.c:363 
> > ioctl MTIOCGET error on "LTO-5" (/dev/nst0). ERR=Erfolg.
> > 18-Mär 13:20 fritzie15-sd JobId 12352: Marking Volume 
> > "LTO-5-Tape0027" in Error in Catalog.
> >  
> > Now, I am a bit afraid, because I do not know, if a restore of the 
> > backuped data would work.
> >  
> > Thank you all in advance!
> >  
> > Best,
> > 
> > Christian
> >  
> > 
> 
> 
> 
> _______________________________________________
> Bacula-users mailing list
> Bacula-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/bacula-users
> 
> 



_______________________________________________
Bacula-users mailing list
Bacula-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users

Reply via email to