<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> <!--Converted with LaTeX2HTML 2008 (1.71) original version by: Nikos Drakos, CBLU, University of Leeds * revised and updated by: Marcus Hennecke, Ross Moore, Herb Swan * with significant contributions from: Jens Lippmann, Marek Rouchal, Martin Wilck and others --> <HTML> <HEAD> <TITLE>Autochanger Resource</TITLE> <META NAME="description" CONTENT="Autochanger Resource"> <META NAME="keywords" CONTENT="main"> <META NAME="resource-type" CONTENT="document"> <META NAME="distribution" CONTENT="global"> <META NAME="Generator" CONTENT="LaTeX2HTML v2008"> <META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css"> <LINK REL="STYLESHEET" HREF="main.css"> <LINK REL="next" HREF="Messages_Resource.html"> <LINK REL="previous" HREF="Storage_Daemon_Configuratio.html"> <LINK REL="up" HREF="Bacula_Main_Reference.html"> <LINK REL="next" HREF="Messages_Resource.html"> </HEAD> <BODY > <!--Navigation Panel--> <A NAME="tex2html1521" HREF="Messages_Resource.html"> <IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next.png"></A> <A NAME="tex2html1515" HREF="Bacula_Main_Reference.html"> <IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up.png"></A> <A NAME="tex2html1509" HREF="Storage_Daemon_Configuratio.html"> <IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="prev.png"></A> <A NAME="tex2html1517" HREF="Contents.html"> <IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="contents.png"></A> <A NAME="tex2html1519" HREF="Thanks.html"> <IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="index.png"></A> <BR> <B> Next:</B> <A NAME="tex2html1522" HREF="Messages_Resource.html">Messages Resource</A> <B> Up:</B> <A NAME="tex2html1516" HREF="Bacula_Main_Reference.html">Bacula Main Reference</A> <B> Previous:</B> <A NAME="tex2html1510" HREF="Storage_Daemon_Configuratio.html">Storage Daemon Configuration</A> <B> <A NAME="tex2html1518" HREF="Contents.html">Contents</A></B> <B> <A NAME="tex2html1520" HREF="Thanks.html">Index</A></B> <BR> <BR> <!--End of Navigation Panel--> <!--Table of Child-Links--> <A NAME="CHILD_LINKS"><STRONG>Subsections</STRONG></A> <UL> <LI><A NAME="tex2html1523" HREF="Autochanger_Resource.html#SECTION002110000000000000000">Capabilities</A> <LI><A NAME="tex2html1524" HREF="Autochanger_Resource.html#SECTION002120000000000000000">Messages Resource</A> <LI><A NAME="tex2html1525" HREF="Autochanger_Resource.html#SECTION002130000000000000000">Sample Storage Daemon Configuration File</A> </UL> <!--End of Table of Child-Links--> <HR> <H1><A NAME="SECTION003200000000000000000"> Autochanger Resource</A> </H1> <A NAME="17103"></A> <A NAME="17104"></A> <P> The Autochanger resource supports single or multiple drive autochangers by grouping one or more Device resources into one unit called an autochanger in Bacula (often referred to as a "tape library" by autochanger manufacturers). <P> If you have an Autochanger, and you want it to function correctly, you <B>must</B> have an Autochanger resource in your Storage conf file, and your Director's Storage directives that want to use an Autochanger <B>must</B> refer to the Autochanger resource name. In previous versions of Bacula, the Director's Storage directives referred directly to Device resources that were autochangers. In version 1.38.0 and later, referring directly to Device resources will not work for Autochangers. <P> <DL> <DT><STRONG>Name = Autochanger-Name</STRONG></DT> <DD><A NAME="17110"></A> Specifies the Name of the Autochanger. This name is used in the Director's Storage definition to refer to the autochanger. This directive is required. <P> </DD> <DT><STRONG>Device = Device-name1, device-name2, ...</STRONG></DT> <DD>Specifies the names of the Device resource or resources that correspond to the autochanger drive. If you have a multiple drive autochanger, you must specify multiple Device names, each one referring to a separate Device resource that contains a Drive Index specification that corresponds to the drive number base zero. You may specify multiple device names on a single line separated by commas, and/or you may specify multiple Device directives. This directive is required. <P> </DD> <DT><STRONG>Changer Device = <I>name-string</I></STRONG></DT> <DD><A NAME="17114"></A> The specified <B>name-string</B> gives the system file name of the autochanger device name. If specified in this resource, the Changer Device name is not needed in the Device resource. If it is specified in the Device resource (see above), it will take precedence over one specified in the Autochanger resource. <P> </DD> <DT><STRONG>Changer Command = <I>name-string</I></STRONG></DT> <DD><A NAME="17117"></A> The <B>name-string</B> specifies an external program to be called that will automatically change volumes as required by <B>Bacula</B>. Most frequently, you will specify the Bacula supplied <B>mtx-changer</B> script as follows. If it is specified here, it need not be specified in the Device resource. If it is also specified in the Device resource, it will take precedence over the one specified in the Autochanger resource. <P> </DD> </DL> <P> The following is an example of a valid Autochanger resource definition: <P> <PRE> Autochanger { Name = "DDS-4-changer" Device = DDS-4-1, DDS-4-2, DDS-4-3 Changer Device = /dev/sg0 Changer Command = "/etc/bacula/mtx-changer %c %o %S %a %d" } Device { Name = "DDS-4-1" Drive Index = 0 Autochanger = yes ... } Device { Name = "DDS-4-2" Drive Index = 1 Autochanger = yes ... Device { Name = "DDS-4-3" Drive Index = 2 Autochanger = yes Autoselect = no ... } </PRE> <P> Please note that it is important to include the <B>Autochanger = yes</B> directive in each Device definition that belongs to an Autochanger. A device definition should not belong to more than one Autochanger resource. Also, your Device directive in the Storage resource of the Director's conf file should have the Autochanger's resource name rather than a name of one of the Devices. <P> If you have a drive that physically belongs to an Autochanger but you don't want to have it automatically used when Bacula references the Autochanger for backups, for example, you want to reserve it for restores, you can add the directive: <P> <PRE> Autoselect = no </PRE> <P> to the Device resource for that drive. In that case, Bacula will not automatically select that drive when accessing the Autochanger. You can, still use the drive by referencing it by the Device name directly rather than the Autochanger name. An example of such a definition is shown above for the Device DDS-4-3, which will not be selected when the name DDS-4-changer is used in a Storage definition, but will be used if DDS-4-3 is used. <P> <A NAME="example"></A> <H1><A NAME="SECTION003210000000000000000"> An Example Configuration File</A> </H1> <A NAME="17129"></A> <A NAME="17130"></A> <P> The following two resources implement an autochanger: <P> <PRE> Autochanger { Name = "Autochanger" Device = DDS-4 Changer Device = /dev/sg0 Changer Command = "/etc/bacula/mtx-changer %c %o %S %a %d" } Device { Name = DDS-4 Media Type = DDS-4 Archive Device = /dev/nst0 # Normal archive device Autochanger = yes LabelMedia = no; AutomaticMount = yes; AlwaysOpen = yes; } </PRE> <P> where you will adapt the <B>Archive Device</B>, the <B>Changer Device</B>, and the path to the <B>Changer Command</B> to correspond to the values used on your system. <P> <H1><A NAME="SECTION003220000000000000000"> A Multi-drive Example Configuration File</A> </H1> <A NAME="17137"></A> <P> The following resources implement a multi-drive autochanger: <P> <PRE> Autochanger { Name = "Autochanger" Device = Drive-1, Drive-2 Changer Device = /dev/sg0 Changer Command = "/etc/bacula/mtx-changer %c %o %S %a %d" } Device { Name = Drive-1 Drive Index = 0 Media Type = DDS-4 Archive Device = /dev/nst0 # Normal archive device Autochanger = yes LabelMedia = no; AutomaticMount = yes; AlwaysOpen = yes; } Device { Name = Drive-2 Drive Index = 1 Media Type = DDS-4 Archive Device = /dev/nst1 # Normal archive device Autochanger = yes LabelMedia = no; AutomaticMount = yes; AlwaysOpen = yes; } </PRE> <P> where you will adapt the <B>Archive Device</B>, the <B>Changer Device</B>, and the path to the <B>Changer Command</B> to correspond to the values used on your system. <P> <A NAME="SpecifyingSlots"></A> <H1><A NAME="SECTION003230000000000000000"> Specifying Slots When Labeling</A> </H1> <A NAME="17145"></A> <A NAME="17146"></A> <P> If you add an <B>Autochanger = yes</B> record to the Storage resource in your Director's configuration file, the Bacula Console will automatically prompt you for the slot number when the Volume is in the changer when you <B>add</B> or <B>label</B> tapes for that Storage device. If your <B>mtx-changer</B> script is properly installed, Bacula will automatically load the correct tape during the label command. <P> You must also set <B>Autochanger = yes</B> in the Storage daemon's Device resource as we have described above in order for the autochanger to be used. Please see the Storage ResourceAutochanger1 in the Director's chapter and the Device ResourceAutochanger in the Storage daemon chapter for more details on these records. <P> Thus all stages of dealing with tapes can be totally automated. It is also possible to set or change the Slot using the <B>update</B> command in the Console and selecting <B>Volume Parameters</B> to update. <P> Even though all the above configuration statements are specified and correct, Bacula will attempt to access the autochanger only if a <B>slot</B> is non-zero in the catalog Volume record (with the Volume name). <P> If your autochanger has barcode labels, you can label all the Volumes in your autochanger one after another by using the <B>label barcodes</B> command. For each tape in the changer containing a barcode, Bacula will mount the tape and then label it with the same name as the barcode. An appropriate Media record will also be created in the catalog. Any barcode that begins with the same characters as specified on the "CleaningPrefix=xxx" command, will be treated as a cleaning tape, and will not be labeled. For example with: <P> Please note that Volumes must be pre-labeled to be automatically used in the autochanger during a backup. If you do not have a barcode reader, this is done manually (or via a script). <P> <PRE> Pool { Name ... Cleaning Prefix = "CLN" } </PRE> <P> Any slot containing a barcode of CLNxxxx will be treated as a cleaning tape and will not be mounted. <P> <H1><A NAME="SECTION003240000000000000000"> Changing Cartridges</A> </H1> <A NAME="17163"></A> If you wish to insert or remove cartridges in your autochanger or you manually run the <B>mtx</B> program, you must first tell Bacula to release the autochanger by doing: <P> <PRE> unmount (change cartridges and/or run mtx) mount </PRE> <P> If you do not do the unmount before making such a change, Bacula will become completely confused about what is in the autochanger and may stop function because it expects to have exclusive use of the autochanger while it has the drive mounted. <P> <A NAME="Magazines"></A> <H1><A NAME="SECTION003250000000000000000"> Dealing with Multiple Magazines</A> </H1> <A NAME="17169"></A> <A NAME="17170"></A> <P> If you have several magazines or if you insert or remove cartridges from a magazine, you should notify Bacula of this. By doing so, Bacula will as a preference, use Volumes that it knows to be in the autochanger before accessing Volumes that are not in the autochanger. This prevents unneeded operator intervention. <P> If your autochanger has barcodes (machine readable tape labels), the task of informing Bacula is simple. Every time, you change a magazine, or add or remove a cartridge from the magazine, simply do <P> <PRE> unmount (remove magazine) (insert new magazine) update slots mount </PRE> <P> in the Console program. This will cause Bacula to request the autochanger to return the current Volume names in the magazine. This will be done without actually accessing or reading the Volumes because the barcode reader does this during inventory when the autochanger is first turned on. Bacula will ensure that any Volumes that are currently marked as being in the magazine are marked as no longer in the magazine, and the new list of Volumes will be marked as being in the magazine. In addition, the Slot numbers of the Volumes will be corrected in Bacula's catalog if they are incorrect (added or moved). <P> If you do not have a barcode reader on your autochanger, you have several alternatives. <P> <OL> <LI>You can manually set the Slot and InChanger flag using the <B>update volume</B> command in the Console (quite painful). <P> </LI> <LI>You can issue a <P> <PRE> update slots scan </PRE> <P> command that will cause Bacula to read the label on each of the cartridges in the magazine in turn and update the information (Slot, InChanger flag) in the catalog. This is quite effective but does take time to load each cartridge into the drive in turn and read the Volume label. <P> </LI> <LI>You can modify the mtx-changer script so that it simulates an autochanger with barcodes. See below for more details. </LI> </OL> <P> <A NAME="simulating"></A> <H1><A NAME="SECTION003260000000000000000"> Simulating Barcodes in your Autochanger</A> </H1> <A NAME="17180"></A> <A NAME="17181"></A> <P> You can simulate barcodes in your autochanger by making the <B>mtx-changer</B> script return the same information that an autochanger with barcodes would do. This is done by commenting out the one and only line in the <B>list)</B> case, which is: <P> <PRE> ${MTX} -f $ctl status | grep " *Storage Element [0-9]*:.*Full" | awk "{print \$3 \$4}" | sed "s/Full *\(:VolumeTag=\)*//" </PRE> <P> at approximately line 99 by putting a # in column one of that line, or by simply deleting it. Then in its place add a new line that prints the contents of a file. For example: <P> <PRE> cat /etc/bacula/changer.volumes </PRE> <P> Be sure to include a full path to the file, which can have any name. The contents of the file must be of the following format: <P> <PRE> 1:Volume1 2:Volume2 3:Volume3 ... </PRE> <P> Where the 1, 2, 3 are the slot numbers and Volume1, Volume2, ... are the Volume names in those slots. You can have multiple files that represent the Volumes in different magazines, and when you change magazines, simply copy the contents of the correct file into your <B>/etc/bacula/changer.volumes</B> file. There is no need to stop and start Bacula when you change magazines, simply put the correct data in the file, then run the <B>update slots</B> command, and your autochanger will appear to Bacula to be an autochanger with barcodes. <A NAME="updateslots"></A> <P> <H1><A NAME="SECTION003270000000000000000"> The Full Form of the Update Slots Command</A> </H1> <A NAME="17194"></A> <A NAME="17195"></A> <P> If you change only one cartridge in the magazine, you may not want to scan all Volumes, so the <B>update slots</B> command (as well as the <B>update slots scan</B> command) has the additional form: <P> <PRE> update slots=n1,n2,n3-n4, ... </PRE> <P> where the keyword <B>scan</B> can be appended or not. The n1,n2, ... represent Slot numbers to be updated and the form n3-n4 represents a range of Slot numbers to be updated (e.g. 4-7 will update Slots 4,5,6, and 7). <P> This form is particularly useful if you want to do a scan (time expensive) and restrict the update to one or two slots. <P> For example, the command: <P> <PRE> update slots=1,6 scan </PRE> <P> will cause Bacula to load the Volume in Slot 1, read its Volume label and update the Catalog. It will do the same for the Volume in Slot 6. The command: <P> <PRE> update slots=1-3,6 </PRE> <P> will read the barcoded Volume names for slots 1,2,3 and 6 and make the appropriate updates in the Catalog. If you don't have a barcode reader or have not modified the mtx-changer script as described above, the above command will not find any Volume names so will do nothing. <A NAME="FreeBSD"></A> <P> <H1><A NAME="SECTION003280000000000000000"> FreeBSD Issues</A> </H1> <A NAME="17207"></A> <A NAME="17208"></A> <P> If you are having problems on FreeBSD when Bacula tries to select a tape, and the message is <B>Device not configured</B>, this is because FreeBSD has made the tape device <B>/dev/nsa1</B> disappear when there is no tape mounted in the autochanger slot. As a consequence, Bacula is unable to open the device. The solution to the problem is to make sure that some tape is loaded into the tape drive before starting Bacula. This problem is corrected in Bacula versions 1.32f-5 and later. <P> Please see the Tape TestingFreeBSDTapes chapter of this manual for <B>important</B> information concerning your tape drive before doing the autochanger testing. <A NAME="AutochangerTesting"></A> <P> <H1><A NAME="SECTION003290000000000000000"> Testing Autochanger and Adapting mtx-changer script</A> </H1> <A NAME="17216"></A> <A NAME="17217"></A> <P> Before attempting to use the autochanger with Bacula, it is preferable to "hand-test" that the changer works. To do so, we suggest you do the following commands (assuming that the <B>mtx-changer</B> script is installed in <B>/etc/bacula/mtx-changer</B>): <P> <DL> <DT><STRONG>Make sure Bacula is not running.</STRONG></DT> <DD><P> </DD> <DT><STRONG>/etc/bacula/mtx-changer /dev/sg0 list 0 /dev/nst0 0</STRONG></DT> <DD><A NAME="17221"></A> <P> This command should print: <P> <PRE> 1: 2: 3: ... </PRE> <P> or one number per line for each slot that is occupied in your changer, and the number should be terminated by a colon (<B>:</B>). If your changer has barcodes, the barcode will follow the colon. If an error message is printed, you must resolve the problem (e.g. try a different SCSI control device name if <B>/dev/sg0</B> is incorrect). For example, on FreeBSD systems, the autochanger SCSI control device is generally <B>/dev/pass2</B>. <P> </DD> <DT><STRONG>/etc/bacula/mtx-changer /dev/sg0 slots </STRONG></DT> <DD><A NAME="17227"></A> <P> This command should return the number of slots in your autochanger. <P> </DD> <DT><STRONG>/etc/bacula/mtx-changer /dev/sg0 unload 1 /dev/nst0 0 </STRONG></DT> <DD><A NAME="17228"></A> <P> If a tape is loaded from slot 1, this should cause it to be unloaded. <P> </DD> <DT><STRONG>/etc/bacula/mtx-changer /dev/sg0 load 3 /dev/nst0 0 </STRONG></DT> <DD><A NAME="17229"></A> <P> Assuming you have a tape in slot 3, it will be loaded into drive (0). <P> </DD> <DT><STRONG>/etc/bacula/mtx-changer /dev/sg0 loaded 0 /dev/nst0 0</STRONG></DT> <DD><A NAME="17230"></A> <P> It should print "3" Note, we have used an "illegal" slot number 0. In this case, it is simply ignored because the slot number is not used. However, it must be specified because the drive parameter at the end of the command is needed to select the correct drive. <P> </DD> <DT><STRONG>/etc/bacula/mtx-changer /dev/sg0 unload 3 /dev/nst0 0</STRONG></DT> <DD><P> will unload the tape into slot 3. <P> </DD> </DL> <P> Once all the above commands work correctly, assuming that you have the right <B>Changer Command</B> in your configuration, Bacula should be able to operate the changer. The only remaining area of problems will be if your autoloader needs some time to get the tape loaded after issuing the command. After the <B>mtx-changer</B> script returns, Bacula will immediately rewind and read the tape. If Bacula gets rewind I/O errors after a tape change, you will probably need to insert a <B>sleep 20</B> after the <B>mtx</B> command, but be careful to exit the script with a zero status by adding <B>exit 0</B> after any additional commands you add to the script. This is because Bacula checks the return status of the script, which should be zero if all went well. <P> You can test whether or not you need a <B>sleep</B> by putting the following commands into a file and running it as a script: <P> <PRE> #!/bin/sh /etc/bacula/mtx-changer /dev/sg0 unload 1 /dev/nst0 0 /etc/bacula/mtx-changer /dev/sg0 load 3 /dev/nst0 0 mt -f /dev/st0 rewind mt -f /dev/st0 weof </PRE> <P> If the above script runs, you probably have no timing problems. If it does not run, start by putting a <B>sleep 30</B> or possibly a <B>sleep 60</B> in the script just after the mtx-changer load command. If that works, then you should move the sleep into the actual <B>mtx-changer</B> script so that it will be effective when Bacula runs. <P> A second problem that comes up with a small number of autochangers is that they need to have the cartridge ejected before it can be removed. If this is the case, the <B>load 3</B> will never succeed regardless of how long you wait. If this seems to be your problem, you can insert an eject just after the unload so that the script looks like: <P> <PRE> #!/bin/sh /etc/bacula/mtx-changer /dev/sg0 unload 1 /dev/nst0 0 mt -f /dev/st0 offline /etc/bacula/mtx-changer /dev/sg0 load 3 /dev/nst0 0 mt -f /dev/st0 rewind mt -f /dev/st0 weof </PRE> <P> Obviously, if you need the <B>offline</B> command, you should move it into the mtx-changer script ensuring that you save the status of the <B>mtx</B> command or always force an <B>exit 0</B> from the script, because Bacula checks the return status of the script. <P> As noted earlier, there are several scripts in <B>bacula-source/examples/devices</B> that implement the above features, so they may be a help to you in getting your script to work. <P> If Bacula complains "Rewind error on /dev/nst0. ERR=Input/output error." you most likely need more sleep time in your <B>mtx-changer</B> before returning to Bacula after a load command has been completed. <P> <A NAME="using"></A> <P> <H1><A NAME="SECTION0032100000000000000000"> Using the Autochanger</A> </H1> <A NAME="17254"></A> <A NAME="17255"></A> <P> Let's assume that you have properly defined the necessary Storage daemon Device records, and you have added the <B>Autochanger = yes</B> record to the Storage resource in your Director's configuration file. <P> Now you fill your autochanger with say six blank tapes. <P> What do you do to make Bacula access those tapes? <P> One strategy is to prelabel each of the tapes. Do so by starting Bacula, then with the Console program, enter the <B>label</B> command: <P> <PRE> ./bconsole Connecting to Director rufus:8101 1000 OK: rufus-dir Version: 1.26 (4 October 2002) *label </PRE> <P> it will then print something like: <P> <PRE> Using default Catalog name=BackupDB DB=bacula The defined Storage resources are: 1: Autochanger 2: File Select Storage resource (1-2): 1 </PRE> <P> I select the autochanger (1), and it prints: <P> <PRE> Enter new Volume name: TestVolume1 Enter slot (0 for none): 1 </PRE> <P> where I entered <B>TestVolume1</B> for the tape name, and slot <B>1</B> for the slot. It then asks: <P> <PRE> Defined Pools: 1: Default 2: File Select the Pool (1-2): 1 </PRE> <P> I select the Default pool. This will be automatically done if you only have a single pool, then Bacula will proceed to unload any loaded volume, load the volume in slot 1 and label it. In this example, nothing was in the drive, so it printed: <P> <PRE> Connecting to Storage daemon Autochanger at localhost:9103 ... Sending label command ... 3903 Issuing autochanger "load slot 1" command. 3000 OK label. Volume=TestVolume1 Device=/dev/nst0 Media record for Volume=TestVolume1 successfully created. Requesting mount Autochanger ... 3001 Device /dev/nst0 is mounted with Volume TestVolume1 You have messages. * </PRE> <P> You may then proceed to label the other volumes. The messages will change slightly because Bacula will unload the volume (just labeled TestVolume1) before loading the next volume to be labeled. <P> Once all your Volumes are labeled, Bacula will automatically load them as they are needed. <P> To "see" how you have labeled your Volumes, simply enter the <B>list volumes</B> command from the Console program, which should print something like the following: <P> <PRE> *{\bf list volumes} Using default Catalog name=BackupDB DB=bacula Defined Pools: 1: Default 2: File Select the Pool (1-2): 1 +-------+----------+--------+---------+-------+--------+----------+-------+------+ | MedId | VolName | MedTyp | VolStat | Bites | LstWrt | VolReten | Recyc | Slot | +-------+----------+--------+---------+-------+--------+----------+-------+------+ | 1 | TestVol1 | DDS-4 | Append | 0 | 0 | 30672000 | 0 | 1 | | 2 | TestVol2 | DDS-4 | Append | 0 | 0 | 30672000 | 0 | 2 | | 3 | TestVol3 | DDS-4 | Append | 0 | 0 | 30672000 | 0 | 3 | | ... | +-------+----------+--------+---------+-------+--------+----------+-------+------+ </PRE> <P> <A NAME="Barcodes"></A> <P> <H1><A NAME="SECTION0032110000000000000000"> Barcode Support</A> </H1> <A NAME="17275"></A> <A NAME="17276"></A> <P> Bacula provides barcode support with two Console commands, <B>label barcodes</B> and <B>update slots</B>. <P> The <B>label barcodes</B> will cause Bacula to read the barcodes of all the cassettes that are currently installed in the magazine (cassette holder) using the <B>mtx-changer</B> <B>list</B> command. Each cassette is mounted in turn and labeled with the same Volume name as the barcode. <P> The <B>update slots</B> command will first obtain the list of cassettes and their barcodes from <B>mtx-changer</B>. Then it will find each volume in turn in the catalog database corresponding to the barcodes and set its Slot to correspond to the value just read. If the Volume is not in the catalog, then nothing will be done. This command is useful for synchronizing Bacula with the current magazine in case you have changed magazines or in case you have moved cassettes from one slot to another. If the autochanger is empty, nothing will be done. <P> The <B>Cleaning Prefix</B> statement can be used in the Pool resource to define a Volume name prefix, which if it matches that of the Volume (barcode) will cause that Volume to be marked with a VolStatus of <B>Cleaning</B>. This will prevent Bacula from attempting to write on the Volume. <P> <H1><A NAME="SECTION0032120000000000000000"> Use bconsole to display Autochanger content</A> </H1> <P> The <B>status slots storage=xxx</B> command displays autochanger content. <P> <PRE> Slot | Volume Name | Status | Type | Pool | Loaded | ------+-----------------+----------+-------------------+----------------+---------| 1 | 00001 | Append | DiskChangerMedia | Default | 0 | 2 | 00002 | Append | DiskChangerMedia | Default | 0 | 3*| 00003 | Append | DiskChangerMedia | Scratch | 0 | 4 | | | | | 0 | </PRE> <P> If you see a <B>*</B> near the slot number, you have to run <B>update slots</B> command to synchronize autochanger content with your catalog. <P> <A NAME="interface"></A> <P> <H1><A NAME="SECTION0032130000000000000000"> Bacula Autochanger Interface</A> </H1> <A NAME="17294"></A> <A NAME="17295"></A> <P> Bacula calls the autochanger script that you specify on the <B>Changer Command</B> statement. Normally this script will be the <B>mtx-changer</B> script that we provide, but it can in fact be any program. The only requirement for the script is that it must understand the commands that Bacula uses, which are <B>loaded</B>, <B>load</B>, <B>unload</B>, <B>list</B>, and <B>slots</B>. In addition, each of those commands must return the information in the precise format as specified below: <P> <PRE> - Currently the changer commands used are: loaded -- returns number of the slot that is loaded, base 1, in the drive or 0 if the drive is empty. load -- loads a specified slot (note, some autochangers require a 30 second pause after this command) into the drive. unload -- unloads the device (returns cassette to its slot). list -- returns one line for each cassette in the autochanger in the format <slot>:<barcode>. Where the {\bf slot} is the non-zero integer representing the slot number, and {\bf barcode} is the barcode associated with the cassette if it exists and if you autoloader supports barcodes. Otherwise the barcode field is blank. slots -- returns total number of slots in the autochanger. </PRE> <P> Bacula checks the exit status of the program called, and if it is zero, the data is accepted. If the exit status is non-zero, Bacula will print an error message and request the tape be manually mounted on the drive. <P> <HR> <!--Navigation Panel--> <A NAME="tex2html1521" HREF="Messages_Resource.html"> <IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next.png"></A> <A NAME="tex2html1515" HREF="Bacula_Main_Reference.html"> <IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up.png"></A> <A NAME="tex2html1509" HREF="Storage_Daemon_Configuratio.html"> <IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="prev.png"></A> <A NAME="tex2html1517" HREF="Contents.html"> <IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="contents.png"></A> <A NAME="tex2html1519" HREF="Thanks.html"> <IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="index.png"></A> <BR> <B> Next:</B> <A NAME="tex2html1522" HREF="Messages_Resource.html">Messages Resource</A> <B> Up:</B> <A NAME="tex2html1516" HREF="Bacula_Main_Reference.html">Bacula Main Reference</A> <B> Previous:</B> <A NAME="tex2html1510" HREF="Storage_Daemon_Configuratio.html">Storage Daemon Configuration</A> <B> <A NAME="tex2html1518" HREF="Contents.html">Contents</A></B> <B> <A NAME="tex2html1520" HREF="Thanks.html">Index</A></B> <!--End of Navigation Panel--> <ADDRESS> 2010-06-14 </ADDRESS> </BODY> </HTML>