]> git.sur5r.net Git - bacula/docs/blob - docs/manuals/en/main/autochangerres.tex
Improve Autochanger documentation
[bacula/docs] / docs / manuals / en / main / autochangerres.tex
1 %%
2 \chapter{Autochanger Resource}
3 \index[sd]{Autochanger Resource}
4 \index[sd]{Resource!Autochanger}
5
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).
10
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.
19
20 \begin{description}
21 \item [Name = \lt{}Autochanger-Name\gt{}]
22    \index[sd]{Name}
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.
26
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.
35
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.  
47
48 On FreeBSD systems, the changer device will typically be on {\bf /dev/pass0}
49 through {\bf /dev/passn}.  
50
51 On Solaris, the changer device will typically be some file under {\bf
52 /dev/rdsk}.  
53
54 Please ensure that your Storage daemon has permission to access this
55 device.
56
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:  
65
66 \footnotesize
67 \begin{verbatim}
68       %% = %
69       %a = archive device name
70       %c = changer device name
71       %d = changer drive index base 0
72       %f = Client's name
73       %j = Job name
74       %o = command  (loaded, load, or unload)
75       %s = Slot base 0
76       %S = Slot base 1
77       %v = Volume name
78 \end{verbatim}
79 \normalsize
80
81 An actual example for using {\bf mtx} with the  {\bf mtx-changer} script (part
82 of the Bacula distribution) is:  
83
84 \footnotesize
85 \begin{verbatim}
86 Changer Command = "/etc/bacula/mtx-changer %c %o %S %a %d"
87 \end{verbatim}
88 \normalsize
89
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} 
94 section below.  
95
96 \end{description}
97
98 The following is an example of a valid Autochanger resource definition: 
99
100 \footnotesize
101 \begin{verbatim}
102 Autochanger {
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"
107 }
108 Device {
109   Name = "DDS-4-1"
110   Drive Index = 0
111   Autochanger = yes
112   ...
113 }
114 Device {
115   Name = "DDS-4-2"
116   Drive Index = 1
117   Autochanger = yes
118   ...
119 Device {
120   Name = "DDS-4-3"
121   Drive Index = 2
122   Autochanger = yes
123   Autoselect = no
124   ...
125 }
126 \end{verbatim}
127 \normalsize
128
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.
134
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:
138
139 \footnotesize
140 \begin{verbatim}
141 Autoselect = no
142 \end{verbatim}
143 \normalsize
144
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.