2 \chapter{Autochanger Resource}
3 \index[sd]{Autochanger Resource}
4 \index[sd]{Resource!Autochanger}
6 The Autochanger resource supports single or multiple drive
7 autochangers by grouping one or more Device resources
8 into one unit called an autochanger in Bacula (often referred to
9 as a "tape library" by autochanger manufacturers).
11 If you have an Autochanger, and you want it to function correctly,
12 you {\bf must} have an Autochanger resource in your Storage
13 conf file, and your Director's Storage directives that want to
14 use an Autochanger {\bf must} refer to the Autochanger resource name.
15 In previous versions of Bacula, the Director's Storage directives
16 referred directly to Device resources that were autochangers.
17 In version 1.38.0 and later, referring directly to Device resources
18 will not work for Autochangers.
21 \item [Name = \lt{}Autochanger-Name\gt{}]
23 Specifies the Name of the Autochanger. This name is used in the
24 Director's Storage definition to refer to the autochanger. This
25 directive is required.
27 \item [Device = \lt{}Device-name1, device-name2, ...\gt{}]
28 Specifies the names of the Device resource or resources that correspond
29 to the autochanger drive. If you have a multiple drive autochanger, you
30 must specify multiple Device names, each one referring to a separate
31 Device resource that contains a Drive Index specification that
32 corresponds to the drive number base zero. You may specify multiple
33 device names on a single line separated by commas, and/or you may
34 specify multiple Device directives. This directive is required.
36 \item [Changer Device = \lt{}device-name\gt{}]
37 \index[sd]{Changer Device }
38 In addition to the Archive Device name, you may specify a {\bf Changer
39 Device} name. This is because most autochangers are controlled through a
40 different device than is used for reading and writing the cartridges. For
41 example, on Linux, one normally uses the generic SCSI interface for
42 controlling the autochanger, but the standard SCSI interface for reading and
43 writing the tapes. On Linux, for the {\bf Archive Device = /dev/nst0}, you
44 would typically have {\bf Changer Device = /dev/sg0}. Note, some of the more
45 advanced autochangers will locate the changer device on {\bf /dev/sg1}. Such
46 devices typically have several drives and a large number of tapes.
48 On FreeBSD systems, the changer device will typically be on {\bf /dev/pass0}
49 through {\bf /dev/passn}.
51 On Solaris, the changer device will typically be some file under {\bf
54 Please ensure that your Storage daemon has permission to access this
57 \item [Changer Command = \lt{}command\gt{}]
58 \index[sd]{Changer Command }
59 This record is used to specify the external program to call and what
60 arguments to pass to it. The command is assumed to be a standard program or
61 shell script that can be executed by the operating system. This command is
62 invoked each time that Bacula wishes to manipulate the autochanger. The
63 following substitutions are made in the {\bf command} before it is sent to
64 the operating system for execution:
69 %a = archive device name
70 %c = changer device name
71 %d = changer drive index base 0
74 %o = command (loaded, load, or unload)
81 An actual example for using {\bf mtx} with the {\bf mtx-changer} script (part
82 of the Bacula distribution) is:
86 Changer Command = "/etc/bacula/mtx-changer %c %o %S %a %d"
90 Where you will need to adapt the {\bf /etc/bacula} to be the actual path on
91 your system where the mtx-changer script resides. Details of the three
92 commands currently used by Bacula (loaded, load, unload) as well as the
93 output expected by Bacula are give in the {\bf Bacula Autochanger Interface}
98 The following is an example of a valid Autochanger resource definition:
103 Name = "DDS-4-changer"
104 Device = DDS-4-1, DDS-4-2, DDS-4-3
105 Changer Device = /dev/sg0
106 Changer Command = "/etc/bacula/mtx-changer %c %o %S %a %d"
129 Please note that it is important to include the {\bf Autochanger = yes} directive
130 in each Device definition that belongs to an Autochanger. A device definition
131 should not belong to more than one Autochanger resource. Also, your Device
132 directive in the Storage resource of the Director's conf file should have
133 the Autochanger's resource name rather than a name of one of the Devices.
135 If you have a drive that physically belongs to an Autochanger but you don't want
136 to have it automatically used when Bacula references the Autochanger for backups,
137 for example, you want to reserve it for restores, you can add the directive:
145 to the Device resource for that drive. In that case, Bacula will not automatically
146 select that drive when accessing the Autochanger. You can, still use the drive
147 by referencing it by the Device name directly rather than the Autochanger name. An example
148 of such a definition is shown above for the Device DDS-4-3, which will not be
149 selected when the name DDS-4-changer is used in a Storage definition, but will
150 be used if DDS-4-3 is used.