4 \section*{Autochangers Support}
5 \label{_ChapterStart18}
6 \index[general]{Support!Autochangers }
7 \index[general]{Autochangers Support }
8 \addcontentsline{toc}{section}{Autochangers Support}
10 \subsection*{Autochangers -- General}
11 \index[general]{General!Autochangers -- }
12 \index[general]{Autochangers -- General }
13 \addcontentsline{toc}{subsection}{Autochangers -- General}
15 Beginning with version 1.23, Bacula provides autochanger support for reading
16 and writing tapes. In order to work with an autochanger, Bacula requires three
17 things, each of which is explained in more detail after this list:
20 \item A script that actually controls the autochanger according to commands
21 sent by Bacula. We furnish such a script that works with {\bf mtx} found in
22 the {\bf depkgs} distribution. This script works only with single drive
24 \item That each Volume (tape) to be used must be defined in the Catalog and
25 have a Slot number assigned to it so that Bacula knows where the Volume is in
26 the autochanger. This is generally done with the {\bf label} command. See
27 below for more details.
28 \item Modifications to your Storage daemon's Device configuration resource to
29 identify that the device is a changer, as well as a few other parameters.
30 \item Optionally, you can modify your Storage resource definition in the
31 Director's configuration file so that you are automatically prompted for the
32 Slot when labeling a Volume.
35 Bacula uses its own {\bf mtx-changer} script to interface with a a program
36 that actually does the tape changing. Thus in principle, {\bf mtx-changer} can
37 be adapted to function with any autochanger program. The current version of
38 {\bf mtx-changer} works with the {\bf mtx} program.
40 As of version 1.30 and later, Bacula supports autochangers with barcode
41 readers. This support includes two new Console commands: {\bf label barcodes}
42 and {\bf update slots}. For more details on these commands, see the ``Barcode
43 Support'' section below.
45 Current Bacula autochanger support does not include cleaning, stackers, or
46 silos. However, under certain conditions, you may be able to make Bacula work
47 with stackers (gravity feed and such). Bacula supports only single drive
48 autochangers. Bacula does have code to operate multi-drive autochangers.
49 However, the implementation is only partial. See below for more details.
51 In principle, if {\bf mtx} will operate your changer correctly, then it is
52 just a question of adapting the {\bf mtx-changer} script (or selecting one
53 already adapted) for proper interfacing. You can find a list of autochangers
54 supported by {\bf mtx} at the following link:
55 \elink{http://mtx.badtux.net/compatibility.php}
56 {http://mtx.badtux.net/compatibility.php}. The home page for the {\bf mtx}
57 project can be found at:
58 \elink{ http://mtx.badtux.net/}{http://mtx.badtux.net/}.
60 If you are having troubles, please use the {\bf auto} command in the {\bf
61 btape} program to test the functioning of your autochanger with Bacula. When
62 Bacula is running, pleas remember that for many distributions (e.g. FreeBSD,
63 Debian, ...) the Storage daemon runs as {\bf bacula.tape} rather than {\bf
64 root.root}, so you will need to ensure that the Storage daemon has sufficient
65 permissions to access the autochanger.
68 \subsection*{Knowing What SCSI Devices You Have}
69 \index[general]{Have!Knowing What SCSI Devices You }
70 \index[general]{Knowing What SCSI Devices You Have }
71 \addcontentsline{toc}{subsection}{Knowing What SCSI Devices You Have}
81 to see what SCSI devices you have available. You can also:
85 cat /proc/scsi/sg/device_hdr /proc/scsi/sg/devices
89 to find out how to specify their control address ({\bf /dev/sg0} for the
90 first, {\bf /dev/sg1} for the second, ...) on the {\bf Changer Device = }
93 Under FreeBSD, you can use:
101 To list the SCSI devices as well as the {\bf /dev/passn} that you will use on
102 the Bacula {\bf Changer Device = } directive.
105 \subsection*{Example Scripts}
106 \index[general]{Scripts!Example }
107 \index[general]{Example Scripts }
108 \addcontentsline{toc}{subsection}{Example Scripts}
110 Please read the sections below so that you understand how autochangers work
111 with Bacula. Although we supply a default {\bf mtx-changer} script, your
112 autochanger may require some additional changes. If you want to see examples
113 of configuration files and scripts, please look in the {\bf
114 \lt{}bacula-src\gt{}/examples/devices} directory where you will find an
115 example {\bf HP-autoloader.conf} Bacula Device resource, and several {\bf
116 mtx-changer} scripts that have been modified to work with different
121 \index[general]{Slots }
122 \addcontentsline{toc}{subsection}{Slots}
124 To properly address autochangers, Bacula must know which Volume is in each
125 {\bf slot} of the autochanger. Slots are where the changer cartridges reside
126 when not loaded into the drive. Bacula numbers these slots from one to the
127 number of cartridges contained in the autochanger.
129 Bacula will not automatically use a Volume in your auotchanger unless it is
130 labeled and the slot number is stored in the catalog. For each Volume in your
131 changer, you will, using the Console program, assign a slot. This information
132 is kept in {\bf Bacula's} catalog database along with the other data for the
133 volume. If no slot is given, or the slot is set to zero, Bacula will not
134 attempt to use the autochanger even if all the necessary configuration records
135 are present. In addition, the console {\bf mount} command does not cause
136 Bacula to operate the autochanger, it only tells Bacula to read any tape that
140 \subsection*{Multiple Devices}
141 \index[general]{Devices!Multiple }
142 \index[general]{Multiple Devices }
143 \addcontentsline{toc}{subsection}{Multiple Devices}
145 Some autochangers have more than one read/write device (drive). The current
146 implementation has limited support for multiple devices by using the {\bf
147 Drive Index} directive in the Device resource of the Storage daemon's
148 configuration file. Drive numbers or the Device Index are numbered beginning
149 at zero, which is the default. To use the second Drive in an autochanger, you
150 need to define a second Device resource and set the Drive Index to one for
151 that device. In general, the second device will have the same {\bf Changer
152 Device} (control channel) as the first drive, but a different {\bf Archive
155 The current implementation of Bacula does not coordinate between the two
156 drives, so you must make sure that Bacula doesn't attempt to mount the same
157 Volume on both drives at the same time. There are a number of ways to do this.
158 One was is to use different pools for each drive.
160 Worse than the above, the {\bf mtx} program apparently does not prevent two
161 accesses to the same control device at the same time, which means that if
162 Bacula happens to attempt to call the mtx-changer script for two drives
163 simultaneously, something will break.
165 A user supplied modified version of the mtx-changer script, which does locking
166 to avoid this problem can be found in {\bf
167 examples/autochangers/locking-mtx-changer}. If you are using multiple drives,
168 you will probably want to modify this script to work for you.
169 \label{ConfigRecords}
171 \subsection*{Device Configuration Records}
172 \index[general]{Records!Device Configuration }
173 \index[general]{Device Configuration Records }
174 \addcontentsline{toc}{subsection}{Device Configuration Records}
176 Configuration of autochangers within Bacula is done in the Device resource of
177 the Storage daemon. Four records: {\bf Autochanger}, {\bf Changer Device},
178 {\bf Changer Command}, and {\bf Maximum Changer Wait} control how Bacula uses
181 These four records, permitted in {\bf Device} resources, are described in
186 \item [Autochanger = {\it Yes|No} ]
187 \index[console]{Autochanger }
188 The {\bf Autochanger} record specifies that the current device is or is not
189 an autochanger. The default is {\bf no}.
191 \item [Changer Device = \lt{}device-name\gt{}]
192 \index[console]{Changer Device }
193 In addition to the Archive Device name, you must specify a {\bf Changer
194 Device} name. This is because most autochangers are controlled through a
195 different device than is used for reading and writing the cartridges. For
196 example, on Linux, one normally uses the generic SCSI interface for
197 controlling the autochanger, but the standard SCSI interface for reading and
198 writing the tapes. On Linux, for the {\bf Archive Device = /dev/nst0}, you
199 would typically have {\bf Changer Device = /dev/sg0}. Note, some of the more
200 advanced autochangers will locate the changer device on {\bf /dev/sg1}. Such
201 devices typically have several drives and a large number of tapes.
203 On FreeBSD systems, the changer device will typically be on {\bf /dev/pass0}
204 through {\bf /dev/passn}.
206 On Solaris, the changer device will typically be some file under {\bf
209 \item [Changer Command = \lt{}command\gt{}]
210 \index[fd]{Changer Command }
211 This record is used to specify the external program to call and what
212 arguments to pass to it. The command is assumed to be a standard program or
213 shell script that can be executed by the operating system. This command is
214 invoked each time that Bacula wishes to manipulate the autochanger. The
215 following substitutions are made in the {\bf command} before it is sent to
216 the operating system for execution:
221 %a = archive device name
222 %c = changer device name
223 %d = changer drive index base 0
226 %o = command (loaded, load, or unload)
234 An actual example for using {\bf mtx} with the {\bf mtx-changer} script (part
235 of the Bacula distribution) is:
239 Changer Command = "/etc/bacula/mtx-changer %c %o %S %a %d"
244 Where you will need to adapt the {\bf /etc/bacula} to be the actual path on
245 your system where the mtx-changer script resides. Details of the three
246 commands currently used by Bacula (loaded, load, unload) as well as the
247 output expected by Bacula are give in the {\bf Bacula Autochanger Interface}
250 \item [Maximum Changer Wait = \lt{}time\gt{}]
251 \index[fd]{Maximum Changer Wait }
252 This record is used to define the maximum amount of time that Bacula will
253 wait for an autoloader to respond to a command (e.g. load). The default is
254 set to 120 seconds. If you have a slow autoloader you may want to set it
257 If the autoloader program fails to respond in this time, it will be killed
258 and Bacula will request operator intervention.
260 \item [Drive Index = \lt{}number\gt{}]
261 \index[fd]{Drive Index }
262 This record allows you to tell Bacula to use the second or subsequent drive
263 in an autochanger with multiple drives. Since the drives are numbered from
264 zero, the second drive is defined by
273 To use the second drive, you need a second Device resource definition in the
274 Bacula configuration file. See the Multiple Drive section above in this
275 chapter for more information.
280 \subsection*{An Example Configuration File}
281 \index[general]{Example Configuration File }
282 \index[general]{File!Example Configuration }
283 \addcontentsline{toc}{subsection}{Example Configuration File}
285 The following {\bf Device} resource implements an autochanger:
292 Archive Device = /dev/nst0 # Normal archive device
293 Changer Device = /dev/sg0 # Generic SCSI device name
294 Changer Command = "/etc/bacula/mtx-changer %c %o %S %a %d"
297 AutomaticMount = yes;
299 Mount Anonymous Volumes = no;
304 where you will adapt the {\bf Archive Device}, the {\bf Changer Device}, and
305 the path to the {\bf Changer Command} to correspond to the values used on your
308 The above {\bf Device} resource will work equally well for any standard tape
309 drive (with device name {\bf /dev/nst0}) since the extra autochanger commands
310 will not be used unless a {\bf slot} has been specified in the catalog record
311 for the Volume to be used. See below for more details on the {\bf slot}.
312 \label{SpecifyingSlots}
314 \subsection*{Specifying Slots When Labeling}
315 \index[general]{Specifying Slots When Labeling }
316 \index[general]{Labeling!Specifying Slots When }
317 \addcontentsline{toc}{subsection}{Specifying Slots When Labeling}
319 If you add an {\bf Autochanger = yes} record to the Storage resource in your
320 Director's configuration file, the Bacula Console will automatically prompt
321 you for the slot number and whether or not the Volume is in the changer when
322 you {\bf add} or {\bf label} tapes for that Storage device. You must also set
323 {\bf Autochanger = yes} in the Device resource as we have described above in
324 order for the autochanger to be used. Please see the
325 \ilink{Storage Resource}{Autochanger1} in the Director's chapter
327 \ilink{Device Resource}{Autochanger} in the Storage daemon
328 chapter for more details on these records.
330 Thus all stages of dealing with tapes can be totally automated. It is also
331 possible to set or change the Slot using the {\bf update} command in the
332 Console and selecting {\bf Volume Parameters} to update.
334 Even though all the above configuration statements are specified and correct,
335 Bacula will attempt to access the autochanger only if a {\bf slot} is non-zero
336 in the catalog Volume record (with the Volume name).
338 p>If your autochanger has barcode labels, you can label all the Volumes in
339 your autochanger one after another by using the {\bf label barcodes} command.
340 For each tape in the changer containing a barcode, Bacula will mount the tape
341 and then label it with the same name as the barcode. An appropriate Media
342 record will also be created in the catalog. Any barcode that begins with the
343 same characters as specified on the ``CleaningPrefix=xxx'' command, will be
344 treated as a cleaning tape, and will not be labeled. For example with:
350 Cleaning Prefix = "CLN"
355 Any slot containing a barcode of CLNxxxx will be treated as a cleaning tape
356 and will not be mounted.
359 \subsection*{Dealing with Multiple Magazines}
360 \index[general]{Dealing with Multiple Magazines }
361 \index[general]{Magazines!Dealing with Multiple }
362 \addcontentsline{toc}{subsection}{Dealing with Multiple Magazines}
364 If you have several magazines or if you insert or remove cartridges from a
365 magazine, you will need to notify Bacula of this. By doing so, Bacula will as
366 a preference, use Volumes that it knows to be in the autochanger before
367 accessing Volumes that are not in the autochanger. This prevents unneeded
368 operator intervention.
370 If your autochanger has barcodes (machine readable tape labels), the task of
371 informing Bacula is simple. Every time, you change a magazine, or add or
372 remove a cartridge from the magazine, simply do
380 in the Console program. This will cause Bacula to request the autochanger to
381 return the current Volume names in the magazine. This will be done without
382 actually accessing or reading the Volumes because the barcode reader does this
383 during inventory when the autochanger is first turned on. Bacula will ensure
384 that any Volumes that are currently marked as being in the magazine are marked
385 as no longer in the magazine, and the new list of Volumes will be marked as
386 being in the magazine. In addition, the Slot numbers of the Volumes will be
387 corrected in Bacula's catalog if they are incorrect (added or moved).
389 If you do not have a barcode reader on your autochanger, you have several
393 \item You can manually set the Slot and InChanger flag using the {\bf update
394 volume} command in the Console (quite painful).
395 \item You can issue a
403 command that will cause Bacula to read the label on each of the cartridges in
404 the magazine in turn and update the information (Slot, InChanger flag) in the
405 catalog. This is quite effective but does take time to load each cartridge
406 into the drive in turn and read the Volume label.
407 \item You can modify the mtx-changer script so that it simulates an
408 autochanger with barcodes. See below for more details.
413 \subsection*{Simulating Barcodes in your Autochanger}
414 \index[general]{Autochanger!Simulating Barcodes in your }
415 \index[general]{Simulating Barcodes in your Autochanger }
416 \addcontentsline{toc}{subsection}{Simulating Barcodes in your Autochanger}
418 You can simulate barcodes in your autochanger by making the {\bf mtx-changer}
419 script return the same information that an autochanger with barcodes would do.
420 This is done by commenting out the one and only line in the {\bf list)} case,
425 ${MTX} -f $ctl status | grep " *Storage Element [0-9]*:.*Full" | awk "{print \$3 \$4}" | sed "s/Full *\(:VolumeTag=\)*//"
429 at approximately line 99 by putting a \# in column one of that line, or by
430 simply deleting it. Then in its place add a new line that prints the contents
431 of a file. For example:
435 cat /etc/bacula/changer.volumes
439 Be sure to include a full path to the file, which can have any name. The
440 contents of the file must be of the following format:
451 Where the 1, 2, 3 are the slot numbers and Volume1, Volume2, ... are the
452 Volume names in those slots. You can have multiple files that represent the
453 Volumes in different magazines, and when you change magazines, simply copy the
454 contents of the correct file into your {\bf /etc/bacula/changer.volumes} file.
455 There is no need to stop and start Bacula when you change magazines, simply
456 put the correct data in the file, then run the {\bf update slots} command, and
457 your autochanger will appear to Bacula to be an autochanger with barcodes.
460 \subsection*{The Full Form of the Update Slots Command}
461 \index[general]{Full Form of the Update Slots Command }
462 \index[general]{Command!Full Form of the Update Slots }
463 \addcontentsline{toc}{subsection}{Full Form of the Update Slots Command}
465 If you change only one cartridge in the magazine, you may not want to scan all
466 Volumes, so the {\bf update slots} command (as well as the {\bf update slots
467 scan} command) has the additional form:
471 update slots=n1,n2,n3-n4, ...
475 where the keyword {\bf scan} can be appended or not. The n1,n2, ... represent
476 Slot numbers to be updated and the form n3-n4 represents a range of Slot
477 numbers to be updates (e.g. 4-7 will update Slots 4,5,6, and 7).
479 This form is particularly useful if you want to do a scan (time expensive) and
480 restrict the update to one or two slots.
482 For example, the command:
486 update slots=1,6 scan
490 will cause Bacula to load the Volume in Slot 1, read its Volume label and
491 update the Catalog. It will do the same for the Volume in Slot 6. The command:
500 will read the barcoded Volume names for slots 1,2,3 and 6 and make the
501 appropriate updates in the Catalog. If you don't have a barcode reader or have
502 not modified the mtx-changer script as described above, the above command will
503 not find any Volume names so will do nothing.
506 \subsection*{FreeBSD Issues}
507 \index[general]{Issues!FreeBSD }
508 \index[general]{FreeBSD Issues }
509 \addcontentsline{toc}{subsection}{FreeBSD Issues}
511 If you are having problems on FreeBSD when Bacula tries to select a tape, and
512 the message is {\bf Device not configured}, this is because FreeBSD has made
513 the tape device {\bf /dev/nsa1} disappear when there is no tape mounted in the
514 autochanger slot. As a consequence, Bacula is unable to open the device. The
515 solution to the problem is to make sure that some tape is loaded into the tape
516 drive before starting Bacula. This problem is correct in Bacula versions
520 \ilink{ Tape Testing}{FreeBSDTapes} chapter of this manual for
521 {\bf important} information concerning your tape drive before doing the
523 \label{AutochangerTesting}
525 \subsection*{Testing the Autochanger and Adapting Your mtx-changer Script}
526 \index[general]{Testing the Autochanger and Adapting Your mtx-changer Script }
527 \index[general]{Script!Testing the Autochanger and Adapting Your mtx-changer }
528 \addcontentsline{toc}{subsection}{Testing the Autochanger and Adapting Your
531 Before attempting to use the autochanger with Bacula, it is preferable to
532 ``hand-test'' that the changer works. To do so, we suggest you do the
533 following commands (assuming that the {\bf mtx-changer} script is installed in
534 {\bf /etc/bacula/mtx-changer}):
538 \item [Make sure Bacula is not running.]
539 \index[fd]{Make sure Bacula is not running. }
541 \item [/etc/bacula/mtx-changer \ /dev/sg0 \ list \ 0 \ /dev/nst0 \ 0]
542 \index[fd]{/etc/bacula/mtx-changer \ /dev/sg0 \ list \ 0 \ /dev/nst0 \ 0
544 This command should print:
556 or one number per line for each slot that is occupied in your changer, and
557 the number should be terminated by a colon ({\bf :}). If your changer has
558 barcodes, the barcode will follow the colon. If an error message is printed,
559 you must resolve the problem (e.g. try a different SCSI control device name
560 if {\bf /dev/sg0} is incorrect. For example, on FreeBSD systems, the
561 autochanger SCSI control device is generally {\bf /dev/pass2}.
563 \item [/etc/bacula/mtx-changer \ /dev/sg0 \ slots \ 0 \ /dev/nst0 \ 0]
564 \index[fd]{/etc/bacula/mtx-changer \ /dev/sg0 \ slots \ 0 \ /dev/nst0 \ 0
566 This command should return the number of slots in your autochanger.
568 \item [/etc/bacula/mtx-changer \ /dev/sg0 \ unload \ ]
569 \index[fd]{/etc/bacula/mtx-changer \ /dev/sg0 \ unload \ }
570 If a tape is loaded, this should cause it to be unloaded.
572 \item [/etc/bacula/mtx-changer \ /dev/sg0 \ load \ 3 \ /dev/nst0 \ 0 ]
573 \index[fd]{/etc/bacula/mtx-changer \ /dev/sg0 \ load \ 3 \ /dev/nst0 \ 0
575 Assuming you have a tape in slot 3, it will be loaded into the read slot (0).
578 \item [/etc/bacula/mtx-changer \ /dev/sg0 \ loaded \ 0 \ /dev/nst0 \ 0]
579 \index[fd]{/etc/bacula/mtx-changer \ /dev/sg0 \ loaded \ 0 \ /dev/nst0 \
581 It should print ``3''
583 \item [/etc/bacula/mtx-changer \ /dev/sg0 \ unload]
584 \index[fd]{/etc/bacula/mtx-changer \ /dev/sg0 \ unload }
587 Once all the above commands work correctly, assuming that you have the right
588 {\bf Changer Command} in your configuration, Bacula should be able to operate
589 the changer. The only remaining area of problems will be if your autoloader
590 needs some time to get the tape loaded after issuing the command. After the
591 {\bf mtx-changer} script returns, Bacula will immediately rewind and read the
592 tape. If Bacula gets rewind I/O errors after a tape change, you will probably
593 need to insert a {\bf sleep 20} after the {\bf mtx} command, but be careful to
594 exit the script with a zero status by adding {\bf exit 0} after any additional
595 commands you add to the script. This is because Bacula checks the return
596 status of the script, which should be zero if all went well.
598 You can test whether or not you need a {\bf sleep} by putting the following
599 commands into a file and running it as a script:
604 /etc/bacula/mtx-changer /dev/sg0 unload
605 /etc/bacula/mtx-changer /dev/sg0 load 3
606 mt -f /dev/st0 rewind
611 If the above script runs, you probably have no timing problems. If it does not
612 run, start by putting a {\bf sleep 30} or possibly a {\bf sleep 60} in the the
613 script just after the mtx-changer load command. If that works, then you should
614 move the sleep into the actual {\bf mtx-changer} script so that it will be
615 effective when Bacula runs.
617 A second problem that comes up with a small number of autochangers is that
618 they need to have the cartridge ejected before it can be removed. If this is
619 the case, the {\bf load 3} will never succeed regardless of how long you wait.
620 If this seems to be your problem, you can insert an eject just after the
621 unload so that the script looks like:
626 /etc/bacula/mtx-changer /dev/sg0 unload
627 mt -f /dev/st0 offline
628 /etc/bacula/mtx-changer /dev/sg0 load 3
629 mt -f /dev/st0 rewind
634 Obviously, if you need the {\bf offline} command, you should move it into the
635 mtx-changer script ensuring that you save the status of the {\bf mtx} command
636 or always force an {\bf exit 0} from the script, because Bacula checks the
637 return status of the script.
639 As noted earlier, there are several scripts in {\bf
640 \lt{}bacula-source\gt{}/examples/devices} that implement the above features,
641 so they may be a help to you in getting your script to work.
643 If Bacula complains ``Rewind error on /dev/nst0. ERR=Input/output error.'' you
644 most likely need more sleep time in your {\bf mtx-changer} before returning to
645 Bacula after a load command has been completed.
648 \subsection*{Using the Autochanger}
649 \index[general]{Using the Autochanger }
650 \index[general]{Autochanger!Using the }
651 \addcontentsline{toc}{subsection}{Using the Autochanger}
653 Let's assume that you have properly defined the necessary Storage daemon
654 Device records, and you have added the {\bf Autochanger = yes} record to the
655 Storage resource in your Director's configuration file.
657 Now you fill your autochanger with say six blank tapes.
659 What do you do to make Bacula access those tapes?
661 One strategy is to prelabel each of the tapes. Do so by starting Bacula, then
662 with the Console program, enter the {\bf label} command:
667 Connecting to Director rufus:8101
668 1000 OK: rufus-dir Version: 1.26 (4 October 2002)
673 it will then print something like:
677 Using default Catalog name=BackupDB DB=bacula
678 The defined Storage resources are:
681 Select Storage resource (1-2): {\bf 1}
685 I select the autochanger (1), and it prints:
689 Enter new Volume name: {\bf TestVolume1}
690 Enter slot (0 for none): {\bf 1}
694 where I entered {\bf TestVolume1} for the tape name, and slot {\bf 1} for the
702 Select the Pool (1-2): {\bf 1}
706 I select the Default pool. This will be automatically done if you only have a
707 single pool, then Bacula will proceed to unload any loaded volume, load the
708 volume in slot 1 and label it. In this example, nothing was in the drive, so
713 Connecting to Storage daemon Autochanger at localhost:9103 ...
714 Sending label command ...
715 3903 Issuing autochanger "load slot 1" command.
716 3000 OK label. Volume=TestVolume1 Device=/dev/nst0
717 Media record for Volume=TestVolume1 successfully created.
718 Requesting mount Autochanger ...
719 3001 Device /dev/nst0 is mounted with Volume TestVolume1
725 You may then proceed to label the other volumes. The messages will change
726 slightly because Bacula will unload the volume (just labeled TestVolume1)
727 before loading the next volume to be labeled.
729 Once all your Volumes are labeled, Bacula will automatically load them as they
732 To ``see'' how you have labeled your Volumes, simply enter the {\bf list
733 volumes} command from the Console program, which should print something like
739 Using default Catalog name=BackupDB DB=bacula
743 Select the Pool (1-2): {\bf 1}
744 +-------+----------+--------+---------+-------+--------+----------+-------+------+
745 | MedId | VolName | MedTyp | VolStat | Bites | LstWrt | VolReten | Recyc | Slot |
746 +-------+----------+--------+---------+-------+--------+----------+-------+------+
747 | 1 | TestVol1 | DDS-4 | Append | 0 | 0 | 30672000 | 0 | 1 |
748 | 2 | TestVol2 | DDS-4 | Append | 0 | 0 | 30672000 | 0 | 2 |
749 | 3 | TestVol3 | DDS-4 | Append | 0 | 0 | 30672000 | 0 | 3 |
751 +-------+----------+--------+---------+-------+--------+----------+-------+------+
757 \subsection*{Barcode Support}
758 \index[general]{Support!Barcode }
759 \index[general]{Barcode Support }
760 \addcontentsline{toc}{subsection}{Barcode Support}
762 Bacula provides barcode support with two Console commands, {\bf label
763 barcodes} and {\bf update slots}.
765 The {\bf label barcodes} will cause Bacula to read the barcodes of all the
766 cassettes that are currently installed in the magazine (cassette holder) using
767 the {\bf mtx-changer} {\bf list} command. Each cassette is mounted in turn and
768 labeled with the same Volume name as the barcode.
770 The {\bf update slots} command will first obtain the list of cassettes and
771 their barcodes from {\bf mtx-changer}. Then it will find each volume in turn
772 in the catalog database corresponding to to the barcodes and set its Slot to
773 correspond to the value just read. If the Volume is not in the catalog, then
774 nothing will be done. This command is useful for synchronizing Bacula with the
775 current magazine in case you have changed magazines or in case you have moved
776 cassettes from one slot to another.
778 The {\bf Cleaning Prefix} statement can be used in the Pool resource to define
779 a Volume name prefix, which if it matches that of the Volume (barcode) will
780 cause that Volume to be marked with a VolStatus of {\bf Cleaning}. This will
781 prevent Bacula from attempting to write on the Volume.
784 \subsection*{Bacula Autochanger Interface}
785 \index[general]{Interface!Bacula Autochanger }
786 \index[general]{Bacula Autochanger Interface }
787 \addcontentsline{toc}{subsection}{Bacula Autochanger Interface}
789 Bacula calls the autochanger script that you specify on the {\bf Changer
790 Device} statement. Normally this script will be the {\bf mtx-changer} script
791 that we can provide, but it can in fact be any program. The only requirements
792 are that the ``commands'' that Bacula uses are {\bf loaded}, {\bf load}, {\bf
793 unload} and {\bf list} ({\bf slots} may be used in the future). In addition,
794 each of those commands must return the information in the precise format as
799 - Currently the changer commands used are:
800 loaded -- returns number of the slot that is loaded in
801 the drive or 0 if the drive is empty.
802 load -- loads a specified slot (note, some autochangers
803 require a 30 second pause after this command) into
805 unload -- unloads the device (returns cassette to its slot).
806 list -- returns one line for each cassette in the autochanger
807 in the format <slot>:<barcode>. Where
808 the {\bf slot} is the non-zero integer representing
809 the slot number, and {\bf barcode} is the barcode
810 associated with the cassette if it exists and if you
811 autoloader supports barcodes. Otherwise the barcode
813 - Other changer commands defined but not yet used:
814 slots -- returns total number of slots in the autochanger.
818 Bacula checks the exit status of the program called, and if it is zero, the
819 data is accepted. If the exit status is non-zero, Bacula ignores any
820 information returned and treats the drive as if it is not an autochanger.