5 \label{_DVDChapterStart}
6 \index[general]{DVD Volumes}
7 \index[general]{Writing DVDs}
8 \index[general]{DVD Writing}
9 \index[general]{Volumes!DVD}
11 Bacula allows you to specify that you want to write to DVD. However,
12 this feature is implemented only in version 1.37 or later.
13 You may in fact write to DVD+RW, DVD+R, DVD-R, or DVD-RW
14 media. The actual process used by Bacula is to first write
15 the image to a spool directory, then when the Volume reaches
16 a certain size or, at your option, at the end of a Job, Bacula
17 will transfer the image from the spool directory to the
18 DVD. The actual work of transferring the image is done
19 by a script {\bf dvd-handler}, and the heart of that
20 script is a program called {\bf growisofs} which allows
21 creating or adding to a DVD ISO filesystem.
23 You must have {\bf dvd+rw-tools} loaded on your system for DVD writing to
24 work. Please note that the original {\bf dvd+rw-tools} package does {\bf
25 NOT} work with Bacula. You must apply a patch which can be found in the
26 {\bf patches} directory of Bacula sources with the name
27 {\bf dvd+rw-tools-5.21.4.10.8.bacula.patch} for version 5.21 of the tools,
28 or patch {bf dvd+rw-tools-6.1.bacula.patch} if you have version 6.1
29 on your system. Unfortunately, this requires you to build the dvd\_rw-tools
32 The fact that Bacula cannot use the OS to write directly
33 to the DVD makes the whole process a bit more error prone than
34 writing to a disk or a tape, but nevertheless, it does work if you
35 use some care to set it up properly. However, at the current time
36 (version 1.39.30 -- 12 December 2006) we still consider this code to be
37 BETA quality. As a consequence, please do careful testing before relying
38 on DVD backups in production.
40 The remainder of this chapter explains the various directives that you can
41 use to control the DVD writing.
44 \section{DVD Specific SD Directives}
45 \index[general]{Directives!DVD}
46 \index[general]{DVD Specific SD Directives }
48 The following directives are added to the Storage daemon's
53 \item [Requires Mount = {\it Yes|No}]
54 \index[sd]{Requires Mount }
55 You must set this directive to {\bf yes} for DVD-writers, and to {\bf no} for
56 all other devices (tapes/files). This directive indicates if the device
57 requires to be mounted using the {\bf Mount Command}.
58 To be able to write a DVD, the following directives must also be
59 defined: {\bf Mount Point}, {\bf Mount Command}, {\bf Unmount Command} and
60 {\bf Write Part Command}.
62 \item [Mount Point = {\it directory}]
63 \index[sd]{Mount Point}
64 Directory where the device can be mounted.
66 \item [Mount Command = {\it name-string}]
67 \index[sd]{Mount Command}
68 Command that must be executed to mount the device. Although the
69 device is written directly, the mount command is necessary in
70 order to determine the free space left on the DVD. Before the command is
71 executed, \%a is replaced with the Archive Device, and \%m with the Mount
74 Most frequently, you will define it as follows:
78 Mount Command = "/bin/mount -t iso9660 -o ro %a %m"
82 However, if you have defined a mount point in /etc/fstab, you might be
83 able to use a mount command such as:
87 Mount Command = "/bin/mount /media/dvd"
92 \item [Unmount Command = {\it name-string}]
93 \index[sd]{Unmount Command}
94 Command that must be executed to unmount the device. Before the command is
95 executed, \%a is replaced with the Archive Device, and \%m with the Mount
98 Most frequently, you will define it as follows:
102 Unmount Command = "/bin/umount %m"
106 \item [Write Part Command = {\it name-string}]
107 \index[sd]{Write Part Command }
108 Command that must be executed to write a part to the device. Before the
109 command is executed, \%a is replaced with the Archive Device, \%m with the
110 Mount Point, \%e is replaced with 1 if we are writing the first part,
111 and with 0 otherwise, and \%v with the current part filename.
113 For a DVD, you will most frequently specify the Bacula supplied {\bf
114 dvd-handler} script as follows:
118 Write Part Command = "/path/dvd-handler %a write %e %v"
122 Where {\bf /path} is the path to your scripts install directory, and
123 dvd-handler is the Bacula supplied script file.
124 This command will already be present, but commented out,
125 in the default bacula-sd.conf file. To use it, simply remove
126 the comment (\#) symbol.
129 \item [Free Space Command = {\it name-string}]
130 \index[sd]{Free Space Command }
131 Command that must be executed to check how much free space is left on the
132 device. Before the command is executed,\%a is replaced with the Archive
135 For a DVD, you will most frequently specify the Bacula supplied {\bf
136 dvd-handler} script as follows:
140 Free Space Command = "/path/dvd-handler %a free"
144 Where {\bf /path} is the path to your scripts install directory, and
145 dvd-freespace is the Bacula supplied script file.
146 If you want to specify your own command, please look at the code in
147 dvd-handler to see what output Bacula expects from this command.
148 This command will already be present, but commented out,
149 in the default bacula-sd.conf file. To use it, simply remove
150 the comment (\#) symbol.
152 If you do not set it, Bacula will expect there is always free space on the
157 In addition to the directives specified above, you must also
158 specify the other standard Device resource directives. Please see the
159 sample DVD Device resource in the default bacula-sd.conf file. Be sure
160 to specify the raw device name for {\bf Archive Device}. It should
161 be a name such as {\bf /dev/cdrom} or {\bf /media/cdrecorder} or
162 {\bf /dev/dvd} depending on your system. It will not be a name such
165 Finally, for {\bf growisofs} to work, it must be able to lock
166 a certain amount of memory in RAM. If you have restrictions on
167 this function, you may have failures. Under {\bf bash}, you can
168 set this with the following command:
176 \section{Edit Codes for DVD Directives}
177 \index[general]{Directives!DVD Edit Codes}
178 \index[general]{Edit Codes for DVD Directives }
180 Before submitting the {\bf Mount Command}, {\bf Unmount Command},
181 {\bf Write Part Command}, or {\bf Free Space Command} directives
182 to the operating system, Bacula performs character substitution of the
183 following characters:
188 %a = Archive device name
189 %e = erase (set if cannot mount and first part)
192 %v = last part name (i.e. filename)
198 \section{DVD Specific Director Directives}
199 \index[general]{Directives!DVD}
200 \index[general]{DVD Specific Director Directives }
202 The following directives are added to the Director's Job resource.
204 \label{WritePartAfterJob}
206 \item [Write Part After Job = \lt{}yes|no\gt{}]
207 \index[dir]{Write Part After Job }
208 If this directive is set to {\bf yes} (default {\bf no}), the
209 Volume written to a temporary spool file for the current Job will
210 be written to the DVD as a new part file
211 will be created after the job is finished.
213 It should be set to {\bf yes} when writing to devices that require a mount
214 (for example DVD), so you are sure that the current part, containing
215 this job's data, is written to the device, and that no data is left in
216 the temporary file on the hard disk. However, on some media, like DVD+R
217 and DVD-R, a lot of space (about 10Mb) is lost everytime a part is
218 written. So, if you run several jobs each after another, you could set
219 this directive to {\bf no} for all jobs, except the last one, to avoid
220 wasting too much space, but to ensure that the data is written to the
221 medium when all jobs are finished.
223 This directive is ignored for devices other than DVDs.
229 \section{Other Points}
230 \index[general]{Points!Other }
231 \index[general]{Other Points }
234 \item Please be sure that you have any automatic DVD mounting
235 disabled before running Bacula -- this includes auto mounting
236 in /etc/fstab, hotplug, ... If the DVD is automatically
237 mounted by the OS, it will cause problems when Bacula tries
238 to mount/unmount the DVD.
239 \item Please be sure that you the directive {\bf Write Part After Job}
240 set to {\bf yes}, otherwise the last part of the data to be
241 written will be left in the DVD spool file and not written to
242 the DVD. The DVD will then be unreadable until this last part
243 is written. If you have a series of jobs that are run one at
244 a time, you can turn this off until the last job is run.
245 \item The current code is not designed to have multiple simultaneous
246 jobs writing to the DVD. As a consequence, please ensure that
247 only one DVD backup job runs at any time.
248 \item Writing and reading of DVD+RW seems to work quite reliably
249 provided you are using the patched dvd+rw-mediainfo programs.
250 On the other hand, we do not have enough information to ensure
251 that DVD-RW or other forms of DVDs work correctly.
252 \item DVD+RW supports only about 1000 overwrites. Every time you
253 mount the filesystem read/write will count as one write. This can
254 add up quickly, so it is best to mount your DVD+RW filesystem read-only.
255 Bacula does not need the DVD to be mounted read-write, since it uses
256 the raw device for writing.
257 \item Reformatting DVD+RW 10-20 times can apparently make the medium
258 unusable. Normally you should not have to format or reformat
259 DVD+RW media. If it is necessary, current versions of growisofs will
261 \item We have had several problems writing to DVD-RWs (this does NOT
262 concern DVD+RW), because these media have two writing-modes: {\bf
263 Incremental Sequential} and {\bf Restricted Overwrite}. Depending on
264 your device and the media you use, one of these modes may not work
265 correctly (e.g. {\bf Incremental Sequential} does not work with my NEC
266 DVD-writer and Verbatim DVD-RW).
268 To retrieve the current mode of a DVD-RW, run:
270 dvd+rw-mediainfo /dev/xxx
272 where you replace xxx with your DVD device name.
274 {\bf Mounted Media} line should give you the information.
276 To set the device to {\bf Restricted Overwrite} mode, run:
278 dvd+rw-format /dev/xxx
280 If you want to set it back to the default {\bf Incremental Sequential} mode, run:
282 dvd+rw-format -blank /dev/xxx
285 \item Bacula only accepts to write to blank DVDs. To quickly blank a DVD+/-RW, run
288 dd if=/dev/zero bs=1024 count=512 | growisofs -Z /dev/xxx=/dev/fd/0
290 Then, try to mount the device, if it cannot be mounted, it will be considered
291 as blank by Bacula, if it can be mounted, try a full blank (see below).
293 \item If you wish to blank completely a DVD+/-RW, use the following:
295 growisofs -Z /dev/xxx=/dev/zero
297 where you replace xxx with your DVD device name. However, note that this
298 blanks the whole DVD, which takes quite a long time (16 minutes on mine).
299 \item DVD+RW and DVD-RW support only about 1000 overwrites (i.e. don't use the
300 same medium for years if you don't want to have problems...).
302 To write to the DVD the first time use:
304 growisofs -Z /dev/xxx filename
307 To add additional files (more parts use):
310 growisofs -M /dev/xxx filename
313 The option {\bf -use-the-force-luke=4gms} was added in growisofs 5.20 to
314 override growisofs' behavior of always checking for the 4GB limit.
315 Normally, this option is recommended for all Linux 2.6.8 kernels or
316 greater, since these newer kernels can handle writing more than 4GB.
317 See below for more details on this subject.
319 \item For more information about DVD writing, please look at the
320 \elink{dvd+rw-tools homepage}{http://fy.chalmers.se/~appro/linux/DVD+RW/}.