]> git.sur5r.net Git - bacula/docs/blob - docs/manuals/fr/problems/tapetesting.tex
Reset everything to English
[bacula/docs] / docs / manuals / fr / problems / tapetesting.tex
1 %%
2 %%
3
4 \chapter{Testing Your Tape Drive With Bacula}
5 \label{TapeTestingChapter}
6 \index[general]{Testing Your Tape Drive With Bacula}
7
8 This chapter is concerned with testing and configuring your tape drive to make
9 sure that it will work properly with Bacula using the {\bf btape} program. 
10 \label{summary}
11
12 \section{Get Your Tape Drive Working}
13
14 In general, you should follow the following steps to get your tape drive to
15 work with Bacula. Start with a tape mounted in your drive. If you have an
16 autochanger, load a tape into the drive. We use {\bf /dev/nst0} as the tape
17 drive name, you will need to adapt it according to your system. 
18
19 Do not proceed to the next item until you have succeeded with the previous
20 one. 
21
22 \begin{enumerate}
23 \item Make sure that Bacula (the Storage daemon) is not running
24   or that you have {\bf unmount}ed the drive you will use 
25   for testing.
26
27 \item Use tar to write to, then read from your drive:  
28
29    \footnotesize
30 \begin{verbatim}
31    mt -f /dev/nst0 rewind
32    tar cvf /dev/nst0 .
33    mt -f /dev/nst0 rewind
34    tar tvf /dev/nst0
35    
36 \end{verbatim}
37 \normalsize
38
39 \item Make sure you have a valid and correct Device resource corresponding
40    to your drive.  For Linux users, generally, the default one works.  For
41    FreeBSD users, there are two possible Device configurations (see below).
42    For other drives and/or OSes, you will need to first ensure that your
43    system tape modes are properly setup (see below), then possibly modify 
44    you Device resource depending on the output from the btape program (next
45    item). When doing this, you should consult the \ilink{Storage Daemon
46    Configuration}{StoredConfChapter} of this manual.
47
48 \item If you are using a Fibre Channel to connect your tape drive to
49    Bacula, please be sure to disable any caching in the NSR (network
50    storage router, which is a Fibre Channel to SCSI converter).
51
52 \item Run the btape {\bf test} command:  
53
54    \footnotesize
55 \begin{verbatim}
56    ./btape -c bacula-sd.conf /dev/nst0
57    test
58    
59 \end{verbatim}
60 \normalsize
61
62    It isn't necessary to run the autochanger part of the test at this time,
63    but do not go past this point until the basic test succeeds.  If you do
64    have an autochanger, please be sure to read the \ilink{Autochanger
65    chapter}{AutochangersChapter} of this manual.
66
67 \item Run the btape {\bf fill} command, preferably with two volumes.  This
68    can take a long time. If you have an autochanger and it  is configured, Bacula
69    will automatically use it. If you do  not have it configured, you can manually
70    issue the appropriate  {\bf mtx} command, or press the autochanger buttons to
71    change  the tape when requested to do so. 
72
73 \item FreeBSD users, if you have a pre-5.0 system run the {\bf tapetest}
74    program, and make sure your system is patched if necessary. The tapetest
75    program can be found in the platform/freebsd directory. The instructions
76    for its use are at the top of the file.
77
78 \item Run Bacula, and backup a reasonably small directory, say 60
79    Megabytes.  Do three successive backups of this directory.
80
81 \item Stop Bacula, then restart it.  Do another full backup of the same
82    directory.  Then stop and restart Bacula.
83
84 \item Do a restore of the directory backed up, by entering the  following
85    restore command, being careful to restore it to  an alternate location:  
86
87
88 \footnotesize
89 \begin{verbatim}
90    restore select all done
91    yes
92    
93 \end{verbatim}
94 \normalsize
95
96    Do a {\bf diff} on the restored directory to ensure it is identical  to the
97    original directory. If you are going to backup multiple different systems
98    (Linux, Windows, Mac, Solaris, FreeBSD, ...), be sure you test the restore
99    on each system type.
100
101 \item If you have an autochanger, you should now go back to the  btape program
102    and run the autochanger test:  
103
104 \footnotesize
105 \begin{verbatim}
106      ./btape -c bacula-sd.conf /dev/nst0
107      auto
108      
109 \end{verbatim}
110 \normalsize
111
112    Adjust your autochanger as necessary to ensure that it works  correctly. See
113    the Autochanger chapter of this manual  for a complete discussion of testing
114    your autochanger.  
115
116 \item We strongly recommend that you use a dedicated SCSI
117    controller for your tape drives. Scanners are known to induce
118    serious problems with the SCSI bus, causing it to reset. If the
119    SCSI bus is reset while Bacula has the tape drive open, it will
120    most likely be fatal to your tape since the drive will rewind.
121    These kinds of problems show up in the system log. For example,
122    the following was most likely caused by a scanner:
123
124 \footnotesize
125 \begin{verbatim}
126 Feb 14 17:29:55 epohost kernel: (scsi0:A:2:0): No or incomplete CDB sent to device.
127 Feb 14 17:29:55 epohost kernel: scsi0: Issued Channel A Bus Reset. 1 SCBs aborted
128 \end{verbatim}
129 \normalsize
130
131 \end{enumerate}
132
133 If you have reached this point, you stand a good chance of having everything
134 work. If you get into trouble at any point, {\bf carefully} read the
135 documentation given below. If you cannot get past some point, ask the {\bf
136 bacula-users} email list, but specify which of the steps you have successfully
137 completed. In particular, you may want to look at the 
138 \ilink{ Tips for Resolving Problems}{problems1} section below. 
139
140
141 \label{NoTapeInDrive}
142 \subsection{Problems When no Tape in Drive}
143 \index[general]{Problems When no Tape in Drive}
144 When Bacula was first written the Linux 2.4 kernel permitted opening the
145 drive whether or not there was a tape in the drive. Thus the Bacula code is
146 based on the concept that if the drive cannot be opened, there is a serious
147 problem, and the job is failed.
148
149 With version 2.6 of the Linux kernel, if there is no tape in the drive, the
150 OS will wait two minutes (default) and then return a failure, and consequently,
151 Bacula version 1.36 and below will fail the job.  This is important to keep
152 in mind, because if you use an option such as {\bf Offline on Unmount =
153 yes}, there will be a point when there is no tape in the drive, and if
154 another job starts or if Bacula asks the operator to mount a tape, when
155 Bacula attempts to open the drive (about a 20 minute delay), it will fail
156 and Bacula will fail the job.
157
158 In version 1.38.x, the Bacula code partially gets around this problem -- at
159 least in the initial open of the drive.  However, functions like Polling
160 the drive do not work correctly if there is no tape in the drive.
161 Providing you do not use {\bf Offline on Unmount = yes}, you should not
162 experience job failures as mentioned above.  If you do experience such
163 failures, you can also increase the {\bf Maximum Open Wait} time interval,
164 which will give you more time to mount the next tape before the job is
165 failed.
166
167 \subsection{Specifying the Configuration File}
168 \index[general]{File!Specifying the Configuration}
169 \index[general]{Specifying the Configuration File}
170
171 Starting with version 1.27, each of the tape utility programs including the
172 {\bf btape} program requires a valid Storage daemon configuration file
173 (actually, the only part of the configuration file that {\bf btape} needs is
174 the {\bf Device} resource definitions). This permits {\bf btape} to find the
175 configuration parameters for your archive device (generally a tape drive).
176 Without those parameters, the testing and utility programs do not know how to
177 properly read and write your drive. By default, they use {\bf bacula-sd.conf}
178 in the current directory, but you may specify a different configuration file
179 using the {\bf -c} option. 
180
181 \subsection{Specifying a Device Name For a Tape}
182 \index[general]{Tape!Specifying a Device Name For a}
183 \index[general]{Specifying a Device Name For a Tape}
184
185 {\bf btape} {\bf device-name} where the Volume can be found. In the case of a
186 tape, this is the physical device name such as {\bf /dev/nst0} or {\bf
187 /dev/rmt/0ubn} depending on your system that you specify on the Archive Device
188 directive. For the program to work, it must find the identical name in the
189 Device resource of the configuration file. If the name is not found in the
190 list of physical names, the utility program will compare the name you entered
191 to the Device names (rather than the Archive device names). 
192
193 When specifying a tape device, it is preferable that the "non-rewind"
194 variant of the device file name be given.  In addition, on systems such as
195 Sun, which have multiple tape access methods, you must be sure to specify
196 to use Berkeley I/O conventions with the device.  The
197 {\bf b} in the Solaris (Sun) archive specification {\bf /dev/rmt/0mbn} is
198 what is needed in this case.  Bacula does not support SysV tape drive
199 behavior.
200
201 See below for specifying Volume names. 
202
203 \subsection{Specifying a Device Name For a File}
204 \index[general]{File!Specifying a Device Name For a}
205 \index[general]{Specifying a Device Name For a File}
206
207 If you are attempting to read or write an archive file rather than a tape, the
208 {\bf device-name} should be the full path to the archive location including
209 the filename. The filename (last part of the specification) will be stripped
210 and used as the Volume name, and the path (first part before the filename)
211 must have the same entry in the configuration file. So, the path is equivalent
212 to the archive device name, and the filename is equivalent to the volume name.
213
214
215 \section{btape}
216 \label{btape1}
217 \index[general]{Btape}
218
219 This program permits a number of elementary tape operations via a tty command
220 interface. The {\bf test} command, described below, can be very useful for
221 testing tape drive compatibility problems. Aside from initial testing of tape
222 drive compatibility with {\bf Bacula}, {\bf btape} will be mostly used by
223 developers writing new tape drivers. 
224
225 {\bf btape} can be dangerous to use with existing {\bf Bacula} tapes because
226 it will relabel a tape or write on the tape if so requested regardless of
227 whether or not the tape contains valuable data, so please be careful and use
228 it only on blank tapes. 
229
230 To work properly, {\bf btape} needs to read the Storage daemon's configuration
231 file. As a default, it will look for {\bf bacula-sd.conf} in the current
232 directory. If your configuration file is elsewhere, please use the {\bf -c}
233 option to specify where. 
234
235 The physical device name or the Device resource name must be specified on the
236 command line, and this same device name must be present in the Storage
237 daemon's configuration file read by {\bf btape} 
238
239 \footnotesize
240 \begin{verbatim}
241 Usage: btape [options] device_name
242        -b <file>   specify bootstrap file
243        -c <file>   set configuration file to file
244        -d <nn>     set debug level to nn
245        -p          proceed inspite of I/O errors
246        -s          turn off signals
247        -v          be verbose
248        -?          print this message.
249 \end{verbatim}
250 \normalsize
251
252 \subsection{Using btape to Verify your Tape Drive}
253 \index[general]{Using btape to Verify your Tape Drive}
254 \index[general]{Drive!Using btape to Verify your Tape}
255
256 An important reason for this program is to ensure that a Storage daemon
257 configuration file is defined so that Bacula will correctly read and write
258 tapes. 
259
260 It is highly recommended that you run the {\bf test} command before running
261 your first Bacula job to ensure that the parameters you have defined for your
262 storage device (tape drive) will permit {\bf Bacula} to function properly. You
263 only need to mount a blank tape, enter the command, and the output should be
264 reasonably self explanatory. For example: 
265
266 \footnotesize
267 \begin{verbatim}
268 (ensure that Bacula is not running)
269 ./btape -c /usr/bin/bacula/bacula-sd.conf /dev/nst0
270 \end{verbatim}
271 \normalsize
272
273 The output will be: 
274
275 \footnotesize
276 \begin{verbatim}
277 Tape block granularity is 1024 bytes.
278 btape: btape.c:376 Using device: /dev/nst0
279 *
280 \end{verbatim}
281 \normalsize
282
283 Enter the test command: 
284
285 \footnotesize
286 \begin{verbatim}
287 test
288 \end{verbatim}
289 \normalsize
290
291 The output produced should be something similar to the following: I've cut the
292 listing short because it is frequently updated to have new tests. 
293
294 \footnotesize
295 \begin{verbatim}
296 === Append files test ===
297 This test is essential to Bacula.
298 I'm going to write one record  in file 0,
299                    two records in file 1,
300              and three records in file 2
301 btape: btape.c:387 Rewound /dev/nst0
302 btape: btape.c:855 Wrote one record of 64412 bytes.
303 btape: btape.c:857 Wrote block to device.
304 btape: btape.c:410 Wrote EOF to /dev/nst0
305 btape: btape.c:855 Wrote one record of 64412 bytes.
306 btape: btape.c:857 Wrote block to device.
307 btape: btape.c:855 Wrote one record of 64412 bytes.
308 btape: btape.c:857 Wrote block to device.
309 btape: btape.c:410 Wrote EOF to /dev/nst0
310 btape: btape.c:855 Wrote one record of 64412 bytes.
311 btape: btape.c:857 Wrote block to device.
312 btape: btape.c:855 Wrote one record of 64412 bytes.
313 btape: btape.c:857 Wrote block to device.
314 btape: btape.c:855 Wrote one record of 64412 bytes.
315 btape: btape.c:857 Wrote block to device.
316 btape: btape.c:410 Wrote EOF to /dev/nst0
317 btape: btape.c:387 Rewound /dev/nst0
318 btape: btape.c:693 Now moving to end of media.
319 btape: btape.c:427 Moved to end of media
320 We should be in file 3. I am at file 3. This is correct!
321 Now the important part, I am going to attempt to append to the tape.
322 ...
323 === End Append files test ===
324 \end{verbatim}
325 \normalsize
326
327 If you do not successfully complete the above test, please resolve the
328 problem(s) before attempting to use {\bf Bacula}. Depending on your tape
329 drive, the test may recommend that you add certain records to your
330 configuration. We strongly recommend that you do so and then re-run the above
331 test to insure it works the first time. 
332
333 Some of the suggestions it provides for resolving the problems may or may not
334 be useful. If at all possible avoid using fixed blocking. If the test suddenly
335 starts to print a long series of: 
336
337 \footnotesize
338 \begin{verbatim}
339 Got EOF on tape.
340 Got EOF on tape.
341 ...
342 \end{verbatim}
343 \normalsize
344
345 then almost certainly, you are running your drive in fixed block mode rather
346 than variable block mode. See below for more help of resolving fix
347 versus variable block problems.
348
349 It is also possible that you have your drive
350 set in SysV tape drive mode. The drive must use BSD tape conventions.
351 See the section above on setting your {\bf Archive device} correctly.
352
353 For FreeBSD users, please see the notes below for doing further testing of
354 your tape drive. 
355
356 \label{SCSITricks}
357 \subsection{Linux SCSI Tricks}
358 \index[general]{Tricks!Linux SCSI}
359 \index[general]{Linux SCSI Tricks}
360
361 You can find out what SCSI devices you have by doing: 
362
363 \footnotesize
364 \begin{verbatim}
365 lsscsi
366 \end{verbatim}
367 \normalsize
368
369 Typical output is:
370
371 \footnotesize
372 \begin{verbatim}
373 [0:0:0:0]    disk    ATA      ST3160812AS      3.AD  /dev/sda
374 [2:0:4:0]    tape    HP       Ultrium 2-SCSI   F6CH  /dev/st0
375 [2:0:5:0]    tape    HP       Ultrium 2-SCSI   F6CH  /dev/st1
376 [2:0:6:0]    mediumx OVERLAND LXB              0107  -
377 [2:0:9:0]    tape    HP       Ultrium 1-SCSI   E50H  /dev/st2
378 [2:0:10:0]   mediumx OVERLAND LXB              0107  -
379 \end{verbatim}
380 \normalsize
381
382 There are two drives in one autochanger: /dev/st0 and /dev/st1
383 and a third tape drive at /dev/st2.  For using them with Bacula, one
384 would normally reference them as /dev/nst0 ... /dev/nst2.  Not also,
385 there are two different autochangers identified as "mediumx OVERLAND LXB".
386 They can be addressed via their /dev/sgN designation, which can be
387 obtained by counting from the beginning as 0 to each changer.  In the
388 above case, the two changers are located on /dev/sg3 and /dev/sg5. The one
389 at /dev/sg3, controls drives /dev/nst0 and /dev/nst1; and the one at
390 /dev/sg5 controles drive /dev/nst2.
391
392 If you do not have the {\bf lsscsi}  command, you can obtain the same
393 information as follows:
394
395 \footnotesize
396 \begin{verbatim}
397 cat /proc/scsi/scsi
398 \end{verbatim}
399 \normalsize
400
401 For the above example with the three drives and two autochangers,
402 I get:
403
404 \footnotesize       
405 \begin{verbatim}
406 Attached devices:
407 Host: scsi0 Channel: 00 Id: 00 Lun: 00
408   Vendor: ATA      Model: ST3160812AS      Rev: 3.AD
409   Type:   Direct-Access                    ANSI SCSI revision: 05
410 Host: scsi2 Channel: 00 Id: 04 Lun: 00
411   Vendor: HP       Model: Ultrium 2-SCSI   Rev: F6CH
412   Type:   Sequential-Access                ANSI SCSI revision: 03
413 Host: scsi2 Channel: 00 Id: 05 Lun: 00
414   Vendor: HP       Model: Ultrium 2-SCSI   Rev: F6CH
415   Type:   Sequential-Access                ANSI SCSI revision: 03
416 Host: scsi2 Channel: 00 Id: 06 Lun: 00
417   Vendor: OVERLAND Model: LXB              Rev: 0107
418   Type:   Medium Changer                   ANSI SCSI revision: 02
419 Host: scsi2 Channel: 00 Id: 09 Lun: 00
420   Vendor: HP       Model: Ultrium 1-SCSI   Rev: E50H
421   Type:   Sequential-Access                ANSI SCSI revision: 03
422 Host: scsi2 Channel: 00 Id: 10 Lun: 00
423   Vendor: OVERLAND Model: LXB              Rev: 0107
424   Type:   Medium Changer                   ANSI SCSI revision: 02
425 \end{verbatim}
426 \normalsize
427
428
429 As an additional example, I get the following (on a different machine from the
430 above example):
431
432 \footnotesize
433 \begin{verbatim}
434 Attached devices:
435 Host: scsi2 Channel: 00 Id: 01 Lun: 00
436   Vendor: HP       Model: C5713A           Rev: H107
437   Type:   Sequential-Access                ANSI SCSI revision: 02
438 Host: scsi2 Channel: 00 Id: 04 Lun: 00
439   Vendor: SONY     Model: SDT-10000        Rev: 0110
440   Type:   Sequential-Access                ANSI SCSI revision: 02
441 \end{verbatim}
442 \normalsize
443
444 The above represents first an autochanger and second a simple
445 tape drive. The HP changer (the first entry) uses the same SCSI channel
446 for data and for control, so in Bacula, you would use: 
447 \footnotesize
448 \begin{verbatim}
449 Archive Device = /dev/nst0
450 Changer Device = /dev/sg0
451 \end{verbatim}
452 \normalsize
453
454 If you want to remove the SDT-10000 device, you can do so as root with: 
455
456 \footnotesize
457 \begin{verbatim}
458 echo "scsi remove-single-device 2 0 4 0">/proc/scsi/scsi
459 \end{verbatim}
460 \normalsize
461
462 and you can put add it back with: 
463
464 \footnotesize
465 \begin{verbatim}
466 echo "scsi add-single-device 2 0 4 0">/proc/scsi/scsi
467 \end{verbatim}
468 \normalsize
469
470 where the 2 0 4 0 are the Host, Channel, Id, and Lun as seen on the output
471 from {\bf cat /proc/scsi/scsi}. Note, the Channel must be specified as
472 numeric. 
473
474 Below is a slightly more complicated output, which is a single autochanger
475 with two drives, and which operates the changer on a different channel
476 from from the drives:
477
478 \footnotesize
479 \begin{verbatim}
480 Attached devices:
481 Host: scsi0 Channel: 00 Id: 00 Lun: 00
482   Vendor: ATA      Model: WDC WD1600JD-75H Rev: 08.0
483   Type:   Direct-Access                    ANSI SCSI revision: 05
484 Host: scsi2 Channel: 00 Id: 04 Lun: 00
485   Vendor: HP       Model: Ultrium 2-SCSI   Rev: F6CH
486   Type:   Sequential-Access                ANSI SCSI revision: 03
487 Host: scsi2 Channel: 00 Id: 05 Lun: 00
488   Vendor: HP       Model: Ultrium 2-SCSI   Rev: F6CH
489   Type:   Sequential-Access                ANSI SCSI revision: 03
490 Host: scsi2 Channel: 00 Id: 06 Lun: 00
491   Vendor: OVERLAND Model: LXB              Rev: 0106
492   Type:   Medium Changer                   ANSI SCSI revision: 02
493 \end{verbatim}
494 \normalsize
495
496 The above tape drives are accessed on /dev/nst0 and /dev/nst1, while
497 the control channel for those two drives is /dev/sg3.
498
499
500
501 \label{problems1}
502 \section{Tips for Resolving Problems}
503 \index[general]{Problems!Tips for Resolving}
504 \index[general]{Tips for Resolving Problems}
505
506 \label{CannotRestore}
507 \subsection{Bacula Saves But Cannot Restore Files}
508 \index[general]{Files!Bacula Saves But Cannot Restore}
509 \index[general]{Bacula Saves But Cannot Restore Files}
510
511 If you are getting error messages such as: 
512
513 \footnotesize
514 \begin{verbatim}
515 Volume data error at 0:1! Wanted block-id: "BB02", got "". Buffer discarded
516 \end{verbatim}
517 \normalsize
518
519 It is very likely that Bacula has tried to do block positioning and ended up
520 at an invalid block. This can happen if your tape drive is in fixed block mode
521 while Bacula's default is variable blocks. Note that in such cases, Bacula is
522 perfectly able to write to your Volumes (tapes), but cannot position to read
523 them. 
524
525 There are two possible solutions. 
526
527 \begin{enumerate}
528 \item The first and  best is to always ensure that your drive is in  variable
529    block mode. Note, it can switch back to  fixed block mode on a reboot or if
530    another program  uses the drive. So on such systems you  need to modify the
531    Bacula startup files  to explicitly set: 
532
533 \footnotesize
534 \begin{verbatim}
535 mt -f /dev/nst0 defblksize 0
536 \end{verbatim}
537 \normalsize
538
539 or whatever is appropriate on your system. Note, if you are running a Linux
540 system, and the above command does not work, it is most likely because you
541 have not loaded the appropriate {\bf mt} package, which is often called
542 {\bf mt\_st}, but may differ according to your distribution.
543
544 \item The second possibility, especially, if Bacula wrote  while the drive was
545    in fixed block mode, is to turn  off block positioning in Bacula. This is done
546    by  adding: 
547
548 \footnotesize
549 \begin{verbatim}
550 Block Positioning = no
551 \end{verbatim}
552 \normalsize
553
554 to the Device resource. This is not the recommended  procedure because it can
555 enormously slow down  recovery of files, but it may help where all else 
556 fails. This directive is available in version 1.35.5  or later (and not yet
557 tested).  
558 \end{enumerate}
559
560 If you are getting error messages such as:
561 \footnotesize
562 \begin{verbatim}
563 Volume data error at 0:0!
564 Block checksum mismatch in block=0 len=32625 calc=345678 blk=123456
565 \end{verbatim}
566 \normalsize
567
568 You are getting tape read errors, and this is most likely due to 
569 one of the following things:
570 \begin{enumerate}
571 \item An old or bad tape.
572 \item A dirty drive that needs cleaning (particularly for DDS drives).
573 \item A loose SCSI cable.
574 \item Old firmware in your drive. Make sure you have the latest firmware
575       loaded.
576 \item Computer memory errors.
577 \item Over-clocking your CPU.
578 \item A bad SCSI card.
579 \end{enumerate}
580
581
582 \label{opendevice}
583 \subsection{Bacula Cannot Open the Device}
584 \index[general]{Device!Bacula Cannot Open the}
585 \index[general]{Bacula Cannot Open the Device}
586
587 If you get an error message such as: 
588
589 \footnotesize
590 \begin{verbatim}
591 dev open failed: dev.c:265 stored: unable to open
592 device /dev/nst0:> ERR=No such device or address
593 \end{verbatim}
594 \normalsize
595
596 the first time you run a job, it is most likely due to the fact that you
597 specified the incorrect device name on your {\bf Archive Device}. 
598
599 If Bacula works fine with your drive, then all off a sudden you get error
600 messages similar to the one shown above, it is quite possible that your driver
601 module is being removed because the kernel deems it idle. This is done via
602 {\bf crontab} with the use of {\bf rmmod -a}. To fix the problem, you can
603 remove this entry from {\bf crontab}, or you can manually {\bf modprob} your
604 driver module (or add it to the local startup script). Thanks to Alan Brown
605 for this tip. 
606 \label{IncorrectFiles}
607
608 \subsection{Incorrect File Number}
609 \index[general]{Number!Incorrect File}
610 \index[general]{Incorrect File Number}
611
612 When Bacula moves to the end of the medium, it normally uses the {\bf
613 ioctl(MTEOM)} function. Then Bacula uses the {\bf ioctl(MTIOCGET)} function to
614 retrieve the current file position from the {\bf mt\_fileno} field. Some SCSI
615 tape drivers will use a fast means of seeking to the end of the medium and in
616 doing so, they will not know the current file position and hence return a {\bf
617 -1}. As a consequence, if you get {\bf "This is NOT correct!"} in the
618 positioning tests, this may be the cause. You must correct this condition in
619 order for Bacula to work. 
620
621 There are two possible solutions to the above problem of incorrect file
622 number: 
623
624 \begin{itemize}
625 \item Figure out how to configure your SCSI driver to  keep track of the file
626    position during the MTEOM  request. This is the preferred solution.  
627 \item Modify the {\bf Device} resource of your {\bf bacula-sd.conf} file  to
628    include:  
629
630 \footnotesize
631 \begin{verbatim}
632 Hardware End of File = no
633 \end{verbatim}
634 \normalsize
635
636 This will cause Bacula to use the MTFSF request to  seek to the end of the
637 medium, and Bacula will keep  track of the file number itself. 
638 \end{itemize}
639
640 \label{IncorrectBlocks}
641 \subsection{Incorrect Number of Blocks or Positioning Errors}
642 \index[general]{Testing!Incorrect Number of Blocks or Positioning Errors}
643 \index[general]{Incorrect Number of Blocks or Positioning Errors}
644
645 {\bf Bacula's} preferred method of working with tape drives (sequential
646 devices) is to run in variable block mode, and this is what is set by default.
647 You should first ensure that your tape drive is set for variable block mode
648 (see below). 
649
650 If your tape drive is in fixed block mode and you have told Bacula to use
651 different fixed block sizes or variable block sizes (default), you will get
652 errors when Bacula attempts to forward space to the correct block (the kernel
653 driver's idea of tape blocks will not correspond to Bacula's). 
654
655 All modern tape drives support variable tape blocks, but some older drives (in
656 particular the QIC drives) as well as the ATAPI ide-scsi driver run only in
657 fixed block mode. The Travan tape drives also apparently must run in fixed
658 block mode (to be confirmed). 
659
660 Even in variable block mode, with the exception of the first record on the
661 second or subsequent volume of a multi-volume backup, Bacula will write blocks
662 of a fixed size. However, in reading a tape, Bacula will assume that for each
663 read request, exactly one block from the tape will be transferred. This the
664 most common way that tape drives work and is well supported by {\bf Bacula}. 
665
666 Drives that run in fixed block mode can cause serious problems for Bacula if
667 the drive's block size does not correspond exactly to {\bf Bacula's} block
668 size. In fixed block size mode, drivers may transmit a partial block or
669 multiple blocks for a single read request. From {\bf Bacula's} point of view,
670 this destroys the concept of tape blocks. It is much better to run in variable
671 block mode, and almost all modern drives (the OnStream is an exception) run in
672 variable block mode. In order for Bacula to run in fixed block mode, you must
673 include the following records in the Storage daemon's Device resource
674 definition: 
675
676 \footnotesize
677 \begin{verbatim}
678 Minimum Block Size = nnn
679 Maximum Block Size = nnn
680 \end{verbatim}
681 \normalsize
682
683 where {\bf nnn} must be the same for both records and must be identical to the
684 driver's fixed block size. 
685
686 We recommend that you avoid this configuration if at all possible by using
687 variable block sizes. 
688
689 If you must run with fixed size blocks, make sure they are not 512 bytes. This
690 is too small and the overhead that Bacula has with each record will become
691 excessive. If at all possible set any fixed block size to something like
692 64,512 bytes or possibly 32,768 if 64,512 is too large for your drive. See
693 below for the details on checking and setting the default drive block size. 
694
695 To recover files from tapes written in fixed block mode, see below. 
696
697 \label{TapeModes}
698 \subsection{Ensuring that the Tape Modes Are Properly Set -- {\bf Linux
699 Only}}
700 \index[general]{Ensuring that the Tape Modes Are Properly Set -- Linux Only}
701
702 If you have a modern SCSI tape drive and you are having problems with the {\bf
703 test} command as noted above, it may be that some program has set one or more
704 of your SCSI driver's options to non-default values. For example, if your
705 driver is set to work in SysV manner, Bacula will not work correctly because
706 it expects BSD behavior. To reset your tape drive to the default values, you
707 can try the following, but {\bf ONLY} if you have a SCSI tape drive on a {\bf
708 Linux} system: 
709
710 \footnotesize
711 \begin{verbatim}
712 become super user
713 mt -f /dev/nst0 rewind
714 mt -f /dev/nst0 stoptions buffer-writes async-writes read-ahead
715 \end{verbatim}
716 \normalsize
717
718 The above commands will clear all options and then set those specified. None
719 of the specified options are required by Bacula, but a number of other options
720 such as SysV behavior must not be set. Bacula does not support SysV tape
721 behavior. On systems other than Linux, you will need to consult your {\bf mt}
722 man pages or documentation to figure out how to do the same thing. This should
723 not really be necessary though -- for example, on both Linux and Solaris
724 systems, the default tape driver options are compatible with Bacula. 
725 On Solaris systems, you must take care to specify the correct device
726 name on the {\bf Archive device} directive. See above for more details.
727
728 You may also want to ensure that no prior program has set the default block
729 size, as happened to one user, by explicitly turning it off with: 
730
731 \footnotesize
732 \begin{verbatim}
733 mt -f /dev/nst0 defblksize 0
734 \end{verbatim}
735 \normalsize
736
737 If you are running a Linux
738 system, and the above command does not work, it is most likely because you
739 have not loaded the appropriate {\bf mt} package, which is often called
740 {\bf mt\_st}, but may differ according to your distribution.
741
742 If you would like to know what options you have set before making any of the
743 changes noted above, you can now view them on Linux systems, thanks to a tip
744 provided by Willem Riede. Do the following: 
745
746 \footnotesize
747 \begin{verbatim}
748 become super user
749 mt -f /dev/nst0 stsetoptions 0
750 grep st0 /var/log/messages
751 \end{verbatim}
752 \normalsize
753
754 and you will get output that looks something like the following: 
755
756 \footnotesize
757 \begin{verbatim}
758 kernel: st0: Mode 0 options: buffer writes: 1, async writes: 1, read ahead: 1
759 kernel: st0:    can bsr: 0, two FMs: 0, fast mteom: 0, auto lock: 0,
760 kernel: st0:    defs for wr: 0, no block limits: 0, partitions: 0, s2 log: 0
761 kernel: st0:    sysv: 0 nowait: 0
762 \end{verbatim}
763 \normalsize
764
765 Note, I have chopped off the beginning of the line with the date and machine
766 name for presentation purposes. 
767
768 Some people find that the above settings only last until the next reboot, so
769 please check this otherwise you may have unexpected problems. 
770
771 Beginning with Bacula version 1.35.8, if Bacula detects that you are running
772 in variable block mode, it will attempt to set your drive appropriately. All
773 OSes permit setting variable block mode, but some OSes do not permit setting
774 the other modes that Bacula needs to function properly. 
775
776 \label{compression}
777 \subsection{Tape Hardware Compression and Blocking Size}
778 \index[general]{Tape Hardware Compression and Blocking Size}
779 \index[general]{Size!Tape Hardware Compression and Blocking Size}
780
781 You should be able to verify the tape compression status with sysfs on Linux.
782 \begin{verbatim}
783 cat /sys/class/scsi_tape/nst0/default_compression
784 \end{verbatim}
785
786 You can, turn it on by using (on Linux): 
787
788 \footnotesize
789 \begin{verbatim}
790 become super user
791 mt -f /dev/nst0 defcompression 1
792 \end{verbatim}
793 \normalsize
794
795 and of course, if you use a zero instead of the one at the end, you will turn
796 it off. 
797
798 If you have built the {\bf mtx} program in the {\bf depkgs} package, you can
799 use tapeinfo to get quite a bit of information about your tape drive even if
800 it is not an autochanger. This program is called using the SCSI control
801 device. On Linux for tape drive /dev/nst0, this is usually /dev/sg0, while on
802 FreeBSD for /dev/nsa0, the control device is often /dev/pass2. For example on
803 my DDS-4 drive (/dev/nst0), I get the following: 
804
805 \footnotesize
806 \begin{verbatim}
807 tapeinfo -f /dev/sg0
808 Product Type: Tape Drive
809 Vendor ID: 'HP      '
810 Product ID: 'C5713A          '
811 Revision: 'H107'
812 Attached Changer: No
813 MinBlock:1
814 MaxBlock:16777215
815 SCSI ID: 5
816 SCSI LUN: 0
817 Ready: yes
818 BufferedMode: yes
819 Medium Type: Not Loaded
820 Density Code: 0x26
821 BlockSize: 0             
822 \end{verbatim}
823 \normalsize
824
825 where the {\bf DataCompEnabled: yes} means that tape hardware compression is
826 turned on. You can turn it on and off (yes|no) by using the {\bf mt}
827 commands given above. Also, this output will tell you if the {\bf BlockSize}
828 is non-zero and hence set for a particular block size. Bacula is not likely to
829 work in such a situation because it will normally attempt to write blocks of
830 64,512 bytes, except the last block of the job which will generally be
831 shorter. The first thing to try is setting the default block size to zero
832 using the {\bf mt -f /dev/nst0 defblksize 0} command as shown above.
833 On FreeBSD, this would be something like: {\bf mt -f /dev/nsa0 blocksize 0}. 
834
835 On some operating systems with some tape drives, the amount of data that
836 can be written to the tape and whether or not compression is enabled is
837 determined by the density usually the {\bf mt -f /dev/nst0 setdensity xxx} command.
838 Often  {\bf mt -f /dev/nst0 status} will print out the current
839 density code that is used with the drive.  Most systems, but unfortunately
840 not all, set the density to the maximum by default. On some systems, you
841 can also get a list of all available density codes with:
842 {\bf mt -f /dev/nst0 densities} or a similar {\bf mt} command.
843 Note, for DLT and SDLT devices, no-compression versus compression is very 
844 often controlled by the density code.  On FreeBSD systems, the compression
845 mode is set using {\bf mt -f /dev/nsa0 comp xxx} where xxx is the
846 mode you want.  In general, see {\bf man mt}  for the options available on
847 your system.
848
849 Note, some of the above {\bf mt} commands may not be persistent depending
850 on your system configuration. That is they may be reset if a program  
851 other than Bacula uses the drive or, as is frequently the case, on reboot
852 of your system.
853                    
854 If your tape drive requires fixed block sizes (very unusual), you can use the
855 following records: 
856
857 \footnotesize
858 \begin{verbatim}
859 Minimum Block Size = nnn
860 Maximum Block Size = nnn
861 \end{verbatim}
862 \normalsize
863
864 in your Storage daemon's Device resource to force Bacula to write fixed size
865 blocks (where you sent nnn to be the same for both of the above records). This
866 should be done only if your drive does not support variable block sizes, or
867 you have some other strong reasons for using fixed block sizes. As mentioned
868 above, a small fixed block size of 512 or 1024 bytes will be very inefficient.
869 Try to set any fixed block size to something like 64,512 bytes or larger if
870 your drive will support it. 
871
872 Also, note that the {\bf Medium Type} field of the output of {\bf tapeinfo}
873 reports {\bf Not Loaded}, which is not correct. As a consequence, you should
874 ignore that field as well as the {\bf Attached Changer} field. 
875
876 To recover files from tapes written in fixed block mode, see below. 
877 \label{FreeBSDTapes}
878
879 \subsection{Tape Modes on FreeBSD}
880 \index[general]{FreeBSD!Tape Modes on}
881 \index[general]{Tape Modes on FreeBSD}
882
883 On most FreeBSD systems such as 4.9 and most tape drives, Bacula should run
884 with: 
885
886 \footnotesize
887 \begin{verbatim}
888 mt  -f  /dev/nsa0  seteotmodel  2
889 mt  -f  /dev/nsa0  blocksize   0
890 mt  -f  /dev/nsa0  comp  enable
891 \end{verbatim}
892 \normalsize
893
894 You might want to put those commands in a startup script to make sure your
895 tape driver is properly initialized before running Bacula, because
896 depending on your system configuration, these modes may be reset if a      
897 program other than Bacula uses the drive or when your system is rebooted.
898
899 Then according to what the {\bf btape test} command returns, you will probably
900 need to set the following (see below for an alternative): 
901
902 \footnotesize
903 \begin{verbatim}
904   Hardware End of Medium = no
905   BSF at EOM = yes
906   Backward Space Record = no
907   Backward Space File = no
908   Fast Forward Space File = no
909   TWO EOF = yes
910 \end{verbatim}
911 \normalsize
912
913 Then be sure to run some append tests with Bacula where you start and stop
914 Bacula between appending to the tape, or use {\bf btape} version 1.35.1 or
915 greater, which includes simulation of stopping/restarting Bacula. 
916
917 Please see the file {\bf platforms/freebsd/pthreads-fix.txt} in the main
918 Bacula directory concerning {\bf important} information concerning
919 compatibility of Bacula and your system. A much more optimal Device
920 configuration is shown below, but does not work with all tape drives. Please
921 test carefully before putting either into production. 
922
923 Note, for FreeBSD 4.10-RELEASE, using a Sony TSL11000 L100 DDS4 with an
924 autochanger set to variable block size and DCLZ compression, Brian McDonald
925 reports that to get Bacula to append correctly between Bacula executions,
926 the correct values to use are:
927
928 \footnotesize
929 \begin{verbatim}
930 mt  -f  /dev/nsa0  seteotmodel  1
931 mt  -f  /dev/nsa0  blocksize  0
932 mt  -f /dev/nsa0  comp  enable
933 \end{verbatim}
934 \normalsize
935
936 and 
937
938 \footnotesize
939 \begin{verbatim}
940   Hardware End of Medium = no
941   BSF at EOM = no
942   Backward Space Record = no
943   Backward Space File = no
944   Fast Forward Space File = yes
945   TWO EOF = no
946 \end{verbatim}
947 \normalsize
948
949 This has been confirmed by several other people using different hardware. This
950 configuration is the preferred one because it uses one EOF and no backspacing
951 at the end of the tape, which works much more efficiently and reliably with
952 modern tape drives. 
953
954 Finally, here is a Device configuration that Danny Butroyd reports to work
955 correctly with the Overland Powerloader tape library using LT0-2 and
956 FreeBSD 5.4-Stable:
957
958 \footnotesize
959 \begin{verbatim}
960 # Overland Powerloader LT02 - 17 slots single drive
961 Device {
962   Name = Powerloader
963   Media Type = LT0-2
964   Archive Device = /dev/nsa0
965   AutomaticMount = yes;              
966   AlwaysOpen = yes;
967   RemovableMedia = yes;
968   RandomAccess = no;
969   Changer Command = "/usr/local/sbin/mtx-changer %c %o %S %a %d"
970   Changer Device = /dev/pass2
971   AutoChanger = yes
972   Alert Command = "sh -c 'tapeinfo -f %c |grep TapeAlert|cat'"
973
974   # FreeBSD Specific Settings
975   Offline On Unmount = no
976   Hardware End of Medium = no
977   BSF at EOM = yes
978   Backward Space Record = no
979   Fast Forward Space File = no
980   TWO EOF = yes
981 }
982
983 The following Device resource works fine with Dell PowerVault 110T and
984 120T devices on both FreeBSD 5.3 and on NetBSD 3.0.  It also works
985 with Sony AIT-2 drives on FreeBSD.
986 \footnotesize
987 \begin{verbatim}
988 Device {
989   ...
990   # FreeBSD/NetBSD Specific Settings
991   Hardware End of Medium = no
992   BSF at EOM = yes
993   Backward Space Record = no
994   Fast Forward Space File = yes
995   TWO EOF = yes
996 }
997 \end{verbatim}
998 \normalsize
999
1000 On FreeBSD version 6.0, it is reported that you can even set
1001 Backward Space Record = yes.
1002
1003
1004
1005 \subsection{Finding your Tape Drives and Autochangers on FreeBSD}
1006 \index[general]{FreeBSD!Finding Tape Drives and Autochangers}
1007 \index[general]{Finding Tape Drives and Autochangers on FreeBSD}
1008
1009 On FreeBSD, you can do a {\bf camcontrol devlist} as root to determine what
1010 drives and autochangers you have. For example, 
1011
1012 \footnotesize
1013 \begin{verbatim}
1014 undef# camcontrol devlist
1015     at scbus0 target 2 lun 0 (pass0,sa0)
1016     at scbus0 target 4 lun 0 (pass1,sa1)
1017     at scbus0 target 4 lun 1 (pass2)
1018 \end{verbatim}
1019 \normalsize
1020
1021 from the above, you can determine that there is a tape drive on {\bf /dev/sa0}
1022 and another on {\bf /dev/sa1} in addition since there is a second line for the
1023 drive on {\bf /dev/sa1}, you know can assume that it is the control device for
1024 the autochanger (i.e. {\bf /dev/pass2}). It is also the control device name to
1025 use when invoking the tapeinfo program. E.g. 
1026
1027 \footnotesize
1028 \begin{verbatim}
1029 tapeinfo -f /dev/pass2
1030 \end{verbatim}
1031 \normalsize
1032
1033 \label{onstream}
1034
1035 \subsection{Using the OnStream driver on Linux Systems}
1036 \index[general]{Using the OnStream driver on Linux Systems}
1037 \index[general]{Systems!Using the OnStream driver on Linux}
1038
1039 Bacula version 1.33 (not 1.32x) is now working and ready for testing with the
1040 OnStream kernel osst driver version 0.9.14 or above. Osst is available from: 
1041 \elink{http://sourceforge.net/projects/osst/}
1042 {http://sourceforge.net/projects/osst/}. 
1043
1044 To make Bacula work you must first load the new driver then, as root, do: 
1045
1046 \footnotesize
1047 \begin{verbatim}
1048   mt -f /dev/nosst0 defblksize 32768
1049 \end{verbatim}
1050 \normalsize
1051
1052 Also you must add the following to your Device resource in your Storage
1053 daemon's conf file: 
1054
1055 \footnotesize
1056 \begin{verbatim}
1057  Minimum Block Size = 32768
1058  Maximum Block Size = 32768
1059 \end{verbatim}
1060 \normalsize
1061
1062 Here is a Device specification provided by Michel Meyers that is known to
1063 work: 
1064
1065 \footnotesize
1066 \begin{verbatim}
1067 Device {
1068   Name = "Onstream DI-30"
1069   Media Type = "ADR-30"
1070   Archive Device = /dev/nosst0
1071   Minimum Block Size = 32768
1072   Maximum Block Size = 32768
1073   Hardware End of Medium = yes
1074   BSF at EOM = no
1075   Backward Space File = yes
1076   Fast Forward Space File = yes
1077   Two EOF = no
1078   AutomaticMount = yes
1079   AlwaysOpen = yes
1080   Removable Media = yes
1081 }
1082 \end{verbatim}
1083 \normalsize
1084
1085 \section{Hardware Compression on EXB-8900}
1086 \index[general]{Hardware Compression on EXB-8900}
1087 \index[general]{EXB-8900!Hardware Compression}
1088
1089 To active, check, or disable the hardware compression feature
1090 on an EXB-8900, use the exabyte MammothTool. You can get it here:
1091 \elink{http://www.exabyte.com/support/online/downloads/index.cfm}
1092 {http://www.exabyte.com/support/online/downloads/index.cfm}.
1093 There is a Solaris version of this tool. With option -C 0 or 1 you
1094 can disable or activate compression. Start this tool without any
1095 options for a small reference.
1096
1097 \label{fill}
1098 \subsection{Using btape to Simulate Filling a Tape}
1099 \index[general]{Using btape to Simulate Filling a Tape}
1100 \index[general]{Tape!Using btape to Simulate Filling}
1101
1102 Because there are often problems with certain tape drives or systems when end
1103 of tape conditions occur, {\bf btape} has a special command {\bf fill} that
1104 causes it to write random data to a tape until the tape fills. It then writes
1105 at least one more Bacula block to a second tape. Finally, it reads back both
1106 tapes to ensure that the data has been written in a way that Bacula can
1107 recover it. Note, there is also a single tape option as noted below, which you
1108 should use rather than the two tape test. See below for more details. 
1109
1110 This can be an extremely time consuming process (here it is about 6 hours) to
1111 fill a full tape. Note, that btape writes random data to the tape when it is
1112 filling it. This has two consequences: 1. it takes a bit longer to generate
1113 the data, especially on slow CPUs. 2. the total amount of data is
1114 approximately the real physical capacity of your tape, regardless of whether
1115 or not the tape drive compression is on or off. This is because random data
1116 does not compress very much. 
1117
1118 To begin this test, you enter the {\bf fill} command and follow the
1119 instructions. There are two options: the simple single tape option and the
1120 multiple tape option. Please use only the simple single tape option because
1121 the multiple tape option still doesn't work totally correctly. If the single
1122 tape option does not succeed, you should correct the problem before using
1123 Bacula. 
1124 \label{RecoveringFiles}
1125
1126 \section{Recovering Files Written With Fixed Block Sizes}
1127 \index[general]{Recovering Files Written With Fixed Block Sizes}
1128
1129 If you have been previously running your tape drive in fixed block mode
1130 (default 512) and Bacula with variable blocks (default), then in version
1131 1.32f-x and 1.34 and above, Bacula will fail to recover files because it does
1132 block spacing, and because the block sizes don't agree between your tape drive
1133 and Bacula it will not work. 
1134
1135 The long term solution is to run your drive in variable block mode as
1136 described above. However, if you have written tapes using fixed block sizes,
1137 this can be a bit of a pain. The solution to the problem is: while you are
1138 doing a restore command using a tape written in fixed block size, ensure that
1139 your drive is set to the fixed block size used while the tape was written.
1140 Then when doing the {\bf restore} command in the Console program, do not
1141 answer the prompt {\bf yes/mod/no}. Instead, edit the bootstrap file (the
1142 location is listed in the prompt) using any ASCII editor. Remove all {\bf
1143 VolBlock} lines in the file. When the file is re-written, answer the question,
1144 and Bacula will run without using block positioning, and it should recover
1145 your files. 
1146
1147 \label{BlockModes}
1148 \section{Tape Blocking Modes}
1149 \index[general]{Modes!Tape Blocking}
1150 \index[general]{Tape Blocking Modes}
1151
1152 SCSI tapes may either be written in {\bf variable} or {\bf fixed} block sizes.
1153 Newer drives support both modes, but some drives such as the QIC devices
1154 always use fixed block sizes. Bacula attempts to fill and write complete
1155 blocks (default 65K), so that in normal mode (variable block size), Bacula
1156 will always write blocks of the same size except the last block of a Job. If
1157 Bacula is configured to write fixed block sizes, it will pad the last block of
1158 the Job to the correct size. Bacula expects variable tape block size drives to
1159 behave as follows: Each write to the drive results in a single record being
1160 written to the tape. Each read returns a single record. If you request less
1161 bytes than are in the record, only those number of bytes will be returned, but
1162 the entire logical record will have been read (the next read will retrieve the
1163 next record). Thus data from a single write is always returned in a single
1164 read, and sequentially written records are returned by sequential reads. 
1165
1166 Bacula expects fixed block size tape drives to behave as follows: If a write
1167 length is greater than the physical block size of the drive, the write will be
1168 written as two blocks each of the fixed physical size. This single write may
1169 become multiple physical records on the tape. (This is not a good situation).
1170 According to the documentation, one may never write an amount of data that is
1171 not the exact multiple of the blocksize (it is not specified if an error
1172 occurs or if the the last record is padded). When reading, it is my
1173 understanding that each read request reads one physical record from the tape.
1174 Due to the complications of fixed block size tape drives, you should avoid
1175 them if possible with Bacula, or you must be ABSOLUTELY certain that you use
1176 fixed block sizes within Bacula that correspond to the physical block size of
1177 the tape drive. This will ensure that Bacula has a one to one correspondence
1178 between what it writes and the physical record on the tape. 
1179
1180 Please note that Bacula will not function correctly if it writes a block and
1181 that block is split into two or more physical records on the tape. Bacula
1182 assumes that each write causes a single record to be written, and that it can
1183 sequentially recover each of the blocks it has written by using the same
1184 number of sequential reads as it had written. 
1185
1186 \section{Details of Tape Modes}
1187 \index[general]{Modes!Details}
1188 \index[general]{Details of Tape Modes}
1189 Rudolf Cejka has provided the following information concerning
1190 certain tape modes and MTEOM.
1191
1192 \begin{description}
1193 \item[Tape level]
1194   It is always possible to position filemarks or blocks, whereas
1195   positioning to the end-of-data is only optional feature, however it is
1196   implemented very often.  SCSI specification also talks about optional
1197   sequential filemarks, setmarks and sequential setmarks, but these are not
1198   implemented so often.  Modern tape drives keep track of file positions in
1199   built-in chip (AIT, LTO) or at the beginning of the tape (SDLT), so there
1200   is not any speed difference, if end-of-data or filemarks is used (I have
1201   heard, that LTO-1 from all 3 manufacturers do not use its chip for file
1202   locations, but a tape as in SDLT case, and I'm not sure about LTO-2 and
1203   LTO-3 case).  However there is a big difference, that end-of-data ignores
1204   file position, whereas filemarks returns the real number of skipped
1205   files, so OS can track current file number just in filemarks case.
1206
1207 \item[OS level]
1208   Solaris does use just SCSI SPACE Filemarks, it does not support SCSI
1209   SPACE End-of-data.  When MTEOM is called, Solaris does use SCSI SPACE
1210   Filemarks with count = 1048576 for fast mode, and combination of SCSI
1211   SPACE Filemarks with count = 1 with SCSI SPACE Blocks with count = 1 for
1212   slow mode, so EOD mark on the tape on some older tape drives is not
1213   skipped.  File number is always tracked for MTEOM.
1214
1215   Linux does support both SCSI SPACE Filemarks and End-of-data: When MTEOM
1216   is called in MT\_ST\_FAST\_MTEOM mode, SCSI SPACE End-of-data is used.
1217   In the other case, SCSI SPACE Filemarks with count =
1218   8388607 is used.  
1219   There is no real slow mode like in Solaris - I just expect, that for
1220   older tape drives Filemarks may be slower than End-of-data, but not so
1221   much as in Solaris slow mode.  File number is tracked for MTEOM just
1222   without MT\_ST\_FAST\_MTEOM - when MT\_ST\_FAST\_MTEOM is used, it is not.
1223
1224   FreeBSD does support both SCSI SPACE Filemarks and End-of-data, but when
1225   MTEOD (MTEOM) is called, SCSI SPACE End-of-data is always used.  FreeBSD
1226   never use SCSI SPACE Filemarks for MTEOD. File number is never tracked
1227   for MTEOD.
1228
1229 \item[Bacula level]
1230   When {\bf Hardware End of Medium = Yes} is used, MTEOM is called, but it
1231   does not mean, that hardware End-of-data must be used.  When Hardware End
1232   of Medium = No, if Fast Forward Space File = Yes, MTFSF with count =
1233   32767 is used, else Block Read with count = 1 with Forward Space File
1234   with count = 1 is used, which is really very slow.
1235
1236 \item [Hardware End of Medium = Yes|No]
1237   The name of this option is misleading and is the source of confusion,
1238   because it is not the hardware EOM, what is really switched here.
1239
1240   If I use Yes, OS must not use SCSI SPACE End-of-data, because Bacula
1241   expects, that there is tracked file number, which is not supported by
1242   SCSI specification.  Instead, the OS have to use SCSI SPACE Filemarks.
1243
1244   If I use No, an action depends on Fast Forward Space File.
1245
1246   When I set {\bf Hardware End of Medium = no}
1247   and {\bf Fast Forward Space File = no}
1248   file positioning was very slow
1249   on my LTO-3 (about ten to 100 minutes), but
1250
1251   with {\bf Hardware End of Medium = no} and
1252 {\bf Fast Forward Space File = yes}, the time is ten to
1253 100 times faster (about one to two minutes).
1254
1255 \end{description}
1256
1257 \section{Tape Performance Problems}
1258 \index[general]{Tape Performance}
1259 If you have LTO-3 or LTO-4 drives, you should be able to
1260 fairly good transfer rates; from 60 to 150 MB/second, providing
1261 you have fast disks; GigaBit Ethernet connections (probably 2); you are 
1262 running multiple simultaneous jobs; you have Bacula data spooling
1263 enabled; your tape block size is set to 131072 or 262144; and
1264 you have set {\bf Maximum File Size = 5G}.
1265
1266 If you are not getting good performance, consider some of the following
1267 suggestions from the Allen Balck on the Bacula Users email list:
1268
1269 \begin{enumerate}
1270 \item You are using an old HBA (i.e. SCSI-1, which only does 5 MB/s)
1271
1272 \item There are other, slower, devices on the SCSI bus. The HBA will
1273    negotiate the speed of every device down to the speed of the
1274    slowest.
1275
1276 \item There is a termination problem on the bus (either too much or
1277    too little termination). The HBA will drop the bus speed in an
1278    attempt to increase the reliability of the bus.
1279
1280 \item Loose or damaged cabling - this will probably make the HBA "think"
1281    you have a termination problem and it will react as in 3 above.
1282 \end{enumerate}
1283
1284 See if /var/adm/messages (or /var/log/messages) tells you what the sync
1285 rate of the SCSI devices/bus are. Also, the next time you reboot, the
1286 BIOS may be able to tell you what the rate of each device is.
1287
1288
1289 \section{Autochanger Errors}
1290 \index[general]{Errors!Autochanger}
1291 \index[general]{Autochanger Errors}
1292
1293 If you are getting errors such as:
1294
1295 \footnotesize
1296 \begin{verbatim}
1297 3992 Bad autochanger "load slot 1, drive 1": ERR=Child exited with code 1.
1298 \end{verbatim}
1299 \normalsize
1300
1301 and you are running your Storage daemon as non-root, then most likely
1302 you are having permissions problems with the control channel. Running
1303 as root, set permissions on /dev/sgX so that the userid and group of
1304 your Storage daemon can access the device. You need to ensure that you
1305 all access to the proper control device, and if you don't have any
1306 SCSI disk drives (including SATA drives), you might want to change
1307 the permissions on /dev/sg*.
1308
1309 \section{Syslog Errors}
1310 \index[general]{Errors!Syslog}
1311 \index[general]{Syslog Errors}
1312
1313 If you are getting errors such as:
1314
1315 \footnotesize
1316 \begin{verbatim}
1317 : kernel: st0: MTSETDRVBUFFER only allowed for root
1318 \end{verbatim}
1319 \normalsize
1320
1321 you are most likely running your Storage daemon as non-root, and
1322 Bacula is attempting to set the correct OS buffering to correspond
1323 to your Device resource. Most OSes allow only root to issue this
1324 ioctl command. In general, the message can be ignored providing 
1325 you are sure that your OS parameters are properly configured as
1326 described earlier in this manual.  If you are running your Storage daemon 
1327 as root, you should not be getting these system log messages, and if
1328 you are, something is probably wrong.