Subject: bacula and NetBSDd st device -- eom confusion
To: None <tech-pkg@netbsd.org, netbsd-users@netbsd.org>
From: Sverre Froyen <sverre@viewmark.com>
List: tech-pkg
Date: 11/02/2005 14:01:29
Hi,

I've been testing sysutils/bacula (1.36.3nb2) on NetBSD (i368 2.0.2_STABLE 
from mid September).  I've run into what looks like an incompatibility in 
tape positioning between bacula and NetBSD's st device.  The scenario is as 
follows:

	1) Run one backup job
	2) Restore the backup
	3) Immediately run a second backup job
	4 )Attempt to restore the second backup

The second restore fails because there is an empty file (EOF mark) between the 
first and second backup on the tape.  This extra EOF mark is not there if 
step (2) is skipped or if the tape is unmounted and remounted between steps 
(2) and (3).  It looks like bacula reads past the second EOF at the end of 
the tape in step (2), sets an internal end-of-tape flag (ST_EOT), and then 
assumes that it is already positioned correctly (because of the end-of-tape 
flag) at the start of step (3).

Here is my device config from bacula-sd.conf:

Device {
  Name = DDS-3
  Description = "DDS-3 for NetBSD"
  Media Type = DDS-3
  Archive Device = /dev/nrst0
  AutomaticMount = yes
  Random Access = no
  RemovableMedia = yes
  AlwaysOpen = yes
  Offline On Unmount = no
  Hardware End of Medium = no
  BSF at EOM = yes
  Backward Space Record = yes
  Fast Forward Space File = yes
  Backward Space File = no
  TWO EOF = yes
}

I have tried various other settings too but have not found one that does not 
show the problem.  BTW, the config passes btape test program.

This is in reality a minor problem because (1) it is not a usual scenario and 
(2) because it can be easily remedied by an unmount / mount sequence.

Sverre