Debian Codegraph @

manuals/en/problems/tapetesting.tex

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