<!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 Support</TITLE> <META NAME="description" CONTENT="Autochanger Support"> <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="Autochanger_Resource.html"> <LINK REL="previous" HREF="Backup_Strategies.html"> <LINK REL="up" HREF="Bacula_Main_Reference.html"> <LINK REL="next" HREF="Autochanger_Resource.html"> </HEAD> <BODY > <!--Navigation Panel--> <A NAME="tex2html1733" HREF="Autochanger_Resource.html"> <IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next.png"></A> <A NAME="tex2html1727" HREF="Bacula_Main_Reference.html"> <IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up.png"></A> <A NAME="tex2html1721" HREF="Backup_Strategies.html"> <IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="prev.png"></A> <A NAME="tex2html1729" HREF="Contents.html"> <IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="contents.png"></A> <A NAME="tex2html1731" HREF="Thanks.html"> <IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="index.png"></A> <BR> <B> Next:</B> <A NAME="tex2html1734" HREF="Autochanger_Resource.html">Autochanger Resource</A> <B> Up:</B> <A NAME="tex2html1728" HREF="Bacula_Main_Reference.html">Bacula Main Reference</A> <B> Previous:</B> <A NAME="tex2html1722" HREF="Backup_Strategies.html">Backup Strategies</A> <B> <A NAME="tex2html1730" HREF="Contents.html">Contents</A></B> <B> <A NAME="tex2html1732" 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="tex2html1735" HREF="Autochanger_Support.html#SECTION003110000000000000000">Knowing What SCSI Devices You Have</A> <LI><A NAME="tex2html1736" HREF="Autochanger_Support.html#SECTION003120000000000000000">Example Scripts</A> <LI><A NAME="tex2html1737" HREF="Autochanger_Support.html#SECTION003130000000000000000">Slots</A> <LI><A NAME="tex2html1738" HREF="Autochanger_Support.html#SECTION003140000000000000000">Multiple Devices</A> <LI><A NAME="tex2html1739" HREF="Autochanger_Support.html#SECTION003150000000000000000">Device Configuration Records</A> </UL> <!--End of Table of Child-Links--> <HR> <H1><A NAME="SECTION003100000000000000000"></A> <A NAME="AutochangersChapter"></A> <BR> Autochanger Support </H1> <A NAME="16677"></A> <A NAME="16678"></A> <P> Bacula provides autochanger support for reading and writing tapes. In order to work with an autochanger, Bacula requires a number of things, each of which is explained in more detail after this list: <P> <UL> <LI>A script that actually controls the autochanger according to commands sent by Bacula. We furnish such a script that works with <B>mtx</B> found in the <B>depkgs</B> distribution. <P> </LI> <LI>That each Volume (tape) to be used must be defined in the Catalog and have a Slot number assigned to it so that Bacula knows where the Volume is in the autochanger. This is generally done with the <B>label</B> command, but can also done after the tape is labeled using the <B>update slots</B> command. See below for more details. You must pre-label the tapes manually before using them. <P> </LI> <LI>Modifications to your Storage daemon's Device configuration resource to identify that the device is a changer, as well as a few other parameters. <P> </LI> <LI>You should also modify your Storage resource definition in the Director's configuration file so that you are automatically prompted for the Slot when labeling a Volume. <P> </LI> <LI>You need to ensure that your Storage daemon (if not running as root) has access permissions to both the tape drive and the control device. <P> </LI> <LI>You need to have <B>Autochanger = yes</B> in your Storage resource in your bacula-dir.conf file so that you will be prompted for the slot number when you label Volumes. </LI> </UL> <P> In version 1.37 and later, there is a new Autochanger resourceAutochangerRes that permits you to group Device resources thus creating a multi-drive autochanger. If you have an autochanger, you <B>must</B> use this new resource. <P> Bacula uses its own <B>mtx-changer</B> script to interface with a program that actually does the tape changing. Thus in principle, <B>mtx-changer</B> can be adapted to function with any autochanger program, or you can call any other script or program. The current version of <B>mtx-changer</B> works with the <B>mtx</B> program. However, FreeBSD users have provided a script in the <B>examples/autochangers</B> directory that allows Bacula to use the <B>chio</B> program. <P> Bacula also supports autochangers with barcode readers. This support includes two Console commands: <B>label barcodes</B> and <B>update slots</B>. For more details on these commands, see the "Barcode Support" section below. <P> Current Bacula autochanger support does not include cleaning, stackers, or silos. Stackers and silos are not supported because Bacula expects to be able to access the Slots randomly. However, if you are very careful to setup Bacula to access the Volumes in the autochanger sequentially, you may be able to make Bacula work with stackers (gravity feed and such). <P> Support for multi-drive autochangers requires the Autochanger resourceAutochangerRes introduced in version 1.37. This resource is also recommended for single drive autochangers. <P> In principle, if <B>mtx</B> will operate your changer correctly, then it is just a question of adapting the <B>mtx-changer</B> script (or selecting one already adapted) for proper interfacing. You can find a list of autochangers supported by <B>mtx</B> at the following link: http://mtx.opensource-sw.net/compatibility.php http://mtx.opensource-sw.net/compatibility.php. The home page for the <B>mtx</B> project can be found at: http://mtx.opensource-sw.net/http://mtx.opensource-sw.net/. <P> Note, we have feedback from some users that there are certain incompatibilities between the Linux kernel and mtx. For example between kernel 2.6.18-8.1.8.el5 of CentOS and RedHat and version 1.3.10 and 1.3.11 of mtx. This was fixed by upgrading to a version 2.6.22 kernel. <P> In addition, apparently certain versions of mtx, for example, version 1.3.11 limit the number of slots to a maximum of 64. The solution was to use version 1.3.10. <P> If you are having troubles, please use the <B>auto</B> command in the <B>btape</B> program to test the functioning of your autochanger with Bacula. When Bacula is running, please remember that for many distributions (e.g. FreeBSD, Debian, ...) the Storage daemon runs as <B>bacula.tape</B> rather than <B>root.root</B>, so you will need to ensure that the Storage daemon has sufficient permissions to access the autochanger. <P> Some users have reported that the the Storage daemon blocks under certain circumstances in trying to mount a volume on a drive that has a different volume loaded. As best we can determine, this is simply a matter of waiting a bit. The drive was previously in use writing a Volume, and sometimes the drive will remain BLOCKED for a good deal of time (up to 7 minutes on a slow drive) waiting for the cassette to rewind and to unload before the drive can be used with a different Volume. <P> <A NAME="SCSI_devices"></A> <H1><A NAME="SECTION003110000000000000000"> Knowing What SCSI Devices You Have</A> </H1> <A NAME="16713"></A> <A NAME="16714"></A> <A NAME="16715"></A> <A NAME="16716"></A> <P> Under Linux, you can <P> <PRE> cat /proc/scsi/scsi </PRE> <P> to see what SCSI devices you have available. You can also: <P> <PRE> cat /proc/scsi/sg/device_hdr /proc/scsi/sg/devices </PRE> <P> to find out how to specify their control address (<B>/dev/sg0</B> for the first, <B>/dev/sg1</B> for the second, ...) on the <B>Changer Device = </B> Bacula directive. <P> You can also use the excellent <B>lsscsi</B> tool. <PRE> $ lsscsi -g [1:0:2:0] tape SEAGATE ULTRIUM06242-XXX 1619 /dev/st0 /dev/sg9 [1:0:14:0] mediumx STK L180 0315 /dev/sch0 /dev/sg10 [2:0:3:0] tape HP Ultrium 3-SCSI G24S /dev/st1 /dev/sg11 [3:0:0:0] enclosu HP A6255A HP04 - /dev/sg3 [3:0:1:0] disk HP 36.4G ST336753FC HP00 /dev/sdd /dev/sg4 </PRE> <P> For more detailed information on what SCSI devices you have please see the Linux SCSI TricksSCSITricks section of the Tape Testing chapter of this manual. <P> Under FreeBSD, you can use: <P> <PRE> camcontrol devlist </PRE> <P> To list the SCSI devices as well as the <B>/dev/passn</B> that you will use on the Bacula <B>Changer Device = </B> directive. <P> Please check that your Storage daemon has permission to access this device. <P> The following tip for FreeBSD users comes from Danny Butroyd: on reboot Bacula will NOT have permission to control the device /dev/pass0 (assuming this is your changer device). To get around this just edit the /etc/devfs.conf file and add the following to the bottom: <PRE> own pass0 root:bacula perm pass0 0666 own nsa0.0 root:bacula perm nsa0.0 0666 </PRE> <P> This gives the bacula group permission to write to the nsa0.0 device too just to be on the safe side. To bring these changes into effect just run:- <P> /etc/rc.d/devfs restart <P> Basically this will stop you having to manually change permissions on these devices to make Bacula work when operating the AutoChanger after a reboot. <P> <A NAME="scripts"></A> <H1><A NAME="SECTION003120000000000000000"> Example Scripts</A> </H1> <A NAME="16737"></A> <A NAME="16738"></A> <P> Please read the sections below so that you understand how autochangers work with Bacula. Although we supply a default <B>mtx-changer</B> script, your autochanger may require some additional changes. If you want to see examples of configuration files and scripts, please look in the <B>bacula-src/examples/devices</B> directory where you will find an example <B>HP-autoloader.conf</B> Bacula Device resource, and several <B>mtx-changer</B> scripts that have been modified to work with different autochangers. <P> <A NAME="Slots"></A> <P> <H1><A NAME="SECTION003130000000000000000"> Slots</A> </H1> <A NAME="16746"></A> <P> To properly address autochangers, Bacula must know which Volume is in each <B>slot</B> of the autochanger. Slots are where the changer cartridges reside when not loaded into the drive. Bacula numbers these slots from one to the number of cartridges contained in the autochanger. <P> Bacula will not automatically use a Volume in your autochanger unless it is labeled and the slot number is stored in the catalog and the Volume is marked as InChanger. This is because it must know where each volume is (slot) to be able to load the volume. For each Volume in your changer, you will, using the Console program, assign a slot. This information is kept in <B>Bacula's</B> catalog database along with the other data for the volume. If no slot is given, or the slot is set to zero, Bacula will not attempt to use the autochanger even if all the necessary configuration records are present. When doing a <B>mount</B> command on an autochanger, you must specify which slot you want mounted. If the drive is loaded with a tape from another slot, it will unload it and load the correct tape, but normally, no tape will be loaded because an <B>unmount</B> command causes Bacula to unload the tape in the drive. <P> You can check if the Slot number and InChanger flag are set by doing a: <PRE> list Volumes </PRE> <P> in the Console program. <P> <A NAME="mult"></A> <H1><A NAME="SECTION003140000000000000000"> Multiple Devices</A> </H1> <A NAME="16755"></A> <A NAME="16756"></A> <P> Some autochangers have more than one read/write device (drive). The new Autochanger resourceAutochangerRes introduced in version 1.37 permits you to group Device resources, where each device represents a drive. The Director may still reference the Devices (drives) directly, but doing so, bypasses the proper functioning of the drives together. Instead, the Director (in the Storage resource) should reference the Autochanger resource name. Doing so permits the Storage daemon to ensure that only one drive uses the mtx-changer script at a time, and also that two drives don't reference the same Volume. <P> Multi-drive requires the use of the <B>Drive Index</B> directive in the Device resource of the Storage daemon's configuration file. Drive numbers or the Device Index are numbered beginning at zero, which is the default. To use the second Drive in an autochanger, you need to define a second Device resource and set the Drive Index to 1 for that device. In general, the second device will have the same <B>Changer Device</B> (control channel) as the first drive, but a different <B>Archive Device</B>. <P> As a default, Bacula jobs will prefer to write to a Volume that is already mounted. If you have a multiple drive autochanger and you want Bacula to write to more than one Volume in the same Pool at the same time, you will need to set Prefer Mounted Volumes PreferMountedVolumes in the Directors Job resource to <B>no</B>. This will cause the Storage daemon to maximize the use of drives. <P> <A NAME="ConfigRecords"></A> <H1><A NAME="SECTION003150000000000000000"> Device Configuration Records</A> </H1> <A NAME="16767"></A> <A NAME="16768"></A> <P> Configuration of autochangers within Bacula is done in the Device resource of the Storage daemon. Four records: <B>Autochanger</B>, <B>Changer Device</B>, <B>Changer Command</B>, and <B>Maximum Changer Wait</B> control how Bacula uses the autochanger. <P> These four records, permitted in <B>Device</B> resources, are described in detail below. Note, however, that the <B>Changer Device</B> and the <B>Changer Command</B> directives are not needed in the Device resource if they are present in the <B>Autochanger</B> resource. <P> <DL> <DT><STRONG>Autochanger = <I>Yes|No</I> </STRONG></DT> <DD><A NAME="16779"></A> The <B>Autochanger</B> record specifies that the current device is or is not an autochanger. The default is <B>no</B>. <P> </DD> <DT><STRONG>Changer Device = device-name</STRONG></DT> <DD><A NAME="16784"></A> In addition to the Archive Device name, you must specify a <B>Changer Device</B> name. This is because most autochangers are controlled through a different device than is used for reading and writing the cartridges. For example, on Linux, one normally uses the generic SCSI interface for controlling the autochanger, but the standard SCSI interface for reading and writing the tapes. On Linux, for the <B>Archive Device = /dev/nst0</B>, you would typically have <B>Changer Device = /dev/sg0</B>. Note, some of the more advanced autochangers will locate the changer device on <B>/dev/sg1</B>. Such devices typically have several drives and a large number of tapes. <P> On FreeBSD systems, the changer device will typically be on <B>/dev/pass0</B> through <B>/dev/passn</B>. <P> On Solaris, the changer device will typically be some file under <B>/dev/rdsk</B>. <P> Please ensure that your Storage daemon has permission to access this device. <P> </DD> <DT><STRONG>Changer Command = command</STRONG></DT> <DD><A NAME="16794"></A> This record is used to specify the external program to call and what arguments to pass to it. The command is assumed to be a standard program or shell script that can be executed by the operating system. This command is invoked each time that Bacula wishes to manipulate the autochanger. The following substitutions are made in the <B>command</B> before it is sent to the operating system for execution: <P> <PRE> %% = % %a = archive device name %c = changer device name %d = changer drive index base 0 %f = Client's name %j = Job name %o = command (loaded, load, or unload) %s = Slot base 0 %S = Slot base 1 %v = Volume name </PRE> <P> An actual example for using <B>mtx</B> with the <B>mtx-changer</B> script (part of the Bacula distribution) is: <P> <PRE> Changer Command = "/etc/bacula/mtx-changer %c %o %S %a %d" </PRE> <P> Where you will need to adapt the <B>/etc/bacula</B> to be the actual path on your system where the mtx-changer script resides. Details of the three commands currently used by Bacula (loaded, load, unload) as well as the output expected by Bacula are give in the <B>Bacula Autochanger Interface</B> section below. <P> </DD> <DT><STRONG>Maximum Changer Wait = time</STRONG></DT> <DD><A NAME="16806"></A> This record is used to define the maximum amount of time that Bacula will wait for an autoloader to respond to a command (e.g. load). The default is set to 120 seconds. If you have a slow autoloader you may want to set it longer. <P> If the autoloader program fails to respond in this time, it will be killed and Bacula will request operator intervention. <P> </DD> <DT><STRONG>Drive Index = number</STRONG></DT> <DD><A NAME="16809"></A> This record allows you to tell Bacula to use the second or subsequent drive in an autochanger with multiple drives. Since the drives are numbered from zero, the second drive is defined by <P> <PRE> Device Index = 1 </PRE> <P> To use the second drive, you need a second Device resource definition in the Bacula configuration file. See the Multiple Drive section above in this chapter for more information. </DD> </DL> <P> In addition, for proper functioning of the Autochanger, you must define an Autochanger resource. <HR> <!--Navigation Panel--> <A NAME="tex2html1733" HREF="Autochanger_Resource.html"> <IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next.png"></A> <A NAME="tex2html1727" HREF="Bacula_Main_Reference.html"> <IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up.png"></A> <A NAME="tex2html1721" HREF="Backup_Strategies.html"> <IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="prev.png"></A> <A NAME="tex2html1729" HREF="Contents.html"> <IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="contents.png"></A> <A NAME="tex2html1731" HREF="Thanks.html"> <IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="index.png"></A> <BR> <B> Next:</B> <A NAME="tex2html1734" HREF="Autochanger_Resource.html">Autochanger Resource</A> <B> Up:</B> <A NAME="tex2html1728" HREF="Bacula_Main_Reference.html">Bacula Main Reference</A> <B> Previous:</B> <A NAME="tex2html1722" HREF="Backup_Strategies.html">Backup Strategies</A> <B> <A NAME="tex2html1730" HREF="Contents.html">Contents</A></B> <B> <A NAME="tex2html1732" HREF="Thanks.html">Index</A></B> <!--End of Navigation Panel--> <ADDRESS> 2010-06-14 </ADDRESS> </BODY> </HTML>