5 \label{_DVDChapterStart}
6 \index[general]{DVD Volumes}
7 \index[general]{Writing DVDs}
8 \index[general]{DVD Writing}
9 \index[general]{Volumes!DVD}
10 \addcontentsline{toc}{section}{DVD Volumes}
12 Bacula allows you to specify that you want to write to DVD. However,
13 this feature is implemented only in version 1.37 or later.
14 You may in fact write to DVD+RW, DVD+R, DVD-R, or DVD-RW
15 media. The actual process used by Bacula is to first write
16 the image to a spool directory, then when the Volume reaches
17 a certain size or, at your option, at the end of a Job, Bacula
18 will transfer the image from the spool directory to the
19 DVD. The actual work of transferring the image is done
20 by a script {\bf dvd-handler}, and the heart of that
21 script is a program called {\bf growisofs} which allows
22 creating or adding to a DVD ISO filesystem.
24 You must have {\bf dvd+rw-tools} loaded on your system for DVD writing to
25 work. Please note that the original {\bf dvd+rw-tools} package does {\bf
26 NOT} work with Bacula. You must apply a patch which can be found in the
27 {\bf patches} directory of Bacula sources with the name
28 {\bf dvd+rw-tools-5.21.4.10.8.bacula.patch} for version 5.21 of the tools,
29 or patch {bf dvd+rw-tools-6.1.bacula.patch} if you have version 6.1
30 on your system. Unfortunately, this requires you to build the dvd_rw-tools
33 The fact that Bacula cannot use the OS to write directly
34 to the DVD makes the whole process a bit more error prone than
35 writing to a disk or a tape, but nevertheless, it does work if you
36 use some care to set it up properly. However, at the current time
37 (26 August 2006) we still consider this code to be experimental and of
38 BETA quality. As a consequence, please do careful testing before relying
39 on DVD backups in production.
41 The remainder of this chapter explains the various directives that you can
42 use to control the DVD writing.
45 \subsection*{DVD Specific SD Directives}
46 \index[general]{Directives!DVD}
47 \index[general]{DVD Specific SD Directives }
48 \addcontentsline{toc}{subsection}{DVD Specific SD Directives}
50 The following directives are added to the Storage daemon's
55 \item [Requires Mount = {\it Yes|No}]
56 \index[sd]{Requires Mount }
57 You must set this directive to {\bf yes} for DVD-writers, and to {\bf no} for
58 all other devices (tapes/files). This directive indicates if the device
59 requires to be mounted using the {\bf Mount Command}.
60 To be able to write a DVD, the following directives must also be
61 defined: {\bf Mount Point}, {\bf Mount Command}, {\bf Unmount Command} and
62 {\bf Write Part Command}.
64 \item [Mount Point = {\it directory}]
65 \index[sd]{Mount Point}
66 Directory where the device can be mounted.
68 \item [Mount Command = {\it name-string}]
69 \index[sd]{Mount Command}
70 Command that must be executed to mount the device. Although the
71 device is written directly, the mount command is necessary in
72 order to determine the free space left on the DVD. Before the command is
73 executed, \%a is replaced with the Archive Device, and \%m with the Mount
76 Most frequently, you will define it as follows:
80 Mount Command = "/bin/mount -t iso9660 -o ro %a %m"
84 However, if you have defined a mount point in /etc/fstab, you might be
85 able to use a mount command such as:
89 Mount Command = "/bin/mount /media/dvd"
94 \item [Unmount Command = {\it name-string}]
95 \index[sd]{Unmount Command}
96 Command that must be executed to unmount the device. Before the command is
97 executed, \%a is replaced with the Archive Device, and \%m with the Mount
100 Most frequently, you will define it as follows:
104 Unmount Command = "/bin/umount %m"
108 \item [Write Part Command = {\it name-string}]
109 \index[sd]{Write Part Command }
110 Command that must be executed to write a part to the device. Before the
111 command is executed, \%a is replaced with the Archive Device, \%m with the
112 Mount Point, \%e is replaced with 1 if we are writing the first part,
113 and with 0 otherwise, and \%v with the current part filename.
115 For a DVD, you will most frequently specify the Bacula supplied {\bf
116 dvd-handler} script as follows:
120 Write Part Command = "/path/dvd-handler %a write %e %v"
124 Where {\bf /path} is the path to your scripts install directory, and
125 dvd-handler is the Bacula supplied script file.
126 This command will already be present, but commented out,
127 in the default bacula-sd.conf file. To use it, simply remove
128 the comment (\#) symbol.
131 \item [Free Space Command = {\it name-string}]
132 \index[sd]{Free Space Command }
133 Command that must be executed to check how much free space is left on the
134 device. Before the command is executed,\%a is replaced with the Archive
137 For a DVD, you will most frequently specify the Bacula supplied {\bf
138 dvd-handler} script as follows:
142 Free Space Command = "/path/dvd-handler %a free"
146 Where {\bf /path} is the path to your scripts install directory, and
147 dvd-freespace is the Bacula supplied script file.
148 If you want to specify your own command, please look at the code in
149 dvd-handler to see what output Bacula expects from this command.
150 This command will already be present, but commented out,
151 in the default bacula-sd.conf file. To use it, simply remove
152 the comment (\#) symbol.
154 If you do not set it, Bacula will expect there is always free space on the
159 In addition to the directives specified above, you must also
160 specify the other standard Device resource directives. Please see the
161 sample DVD Device resource in the default bacula-sd.conf file. Be sure
162 to specify the raw device name for {\bf Archive Device}. It should
163 be a name such as {\bf /dev/cdrom} or {\bf /media/cdrecorder} or
164 {\bf /dev/dvd} depending on your system. It will not be a name such
167 \subsection*{Edit Codes for DVD Directives}
168 \index[general]{Directives!DVD Edit Codes}
169 \index[general]{Edit Codes for DVD Directives }
170 \addcontentsline{toc}{subsection}{Edit Codes fro DVD Directives}
172 Before submitting the {\bf Mount Command}, {\bf Unmount Command},
173 {\bf Write Part Command}, or {\bf Free Space Command} directives
174 to the operating system, Bacula performs character substitution of the
175 following characters:
180 %a = Archive device name
181 %e = erase (set if cannot mount and first part)
184 %v = last part name (i.e. filename)
190 \subsection*{DVD Specific Director Directives}
191 \index[general]{Directives!DVD}
192 \index[general]{DVD Specific Director Directives }
193 \addcontentsline{toc}{subsection}{DVD Specific Director Directives}
195 The following directives are added to the Director's Job resource.
197 \label{WritePartAfterJob}
199 \item [Write Part After Job = \lt{}yes|no\gt{}]
200 \index[dir]{Write Part After Job }
201 If this directive is set to {\bf yes} (default {\bf no}), the
202 Volume written to a temporary spool file for the current Job will
203 be written to the DVD as a new part file
204 will be created after the job is finished.
206 It should be set to {\bf yes} when writing to devices that require a mount
207 (for example DVD), so you are sure that the current part, containing
208 this job's data, is written to the device, and that no data is left in
209 the temporary file on the hard disk. However, on some media, like DVD+R
210 and DVD-R, a lot of space (about 10Mb) is lost everytime a part is
211 written. So, if you run several jobs each after another, you could set
212 this directive to {\bf no} for all jobs, except the last one, to avoid
213 wasting too much space, but to ensure that the data is written to the
214 medium when all jobs are finished.
216 This directive is ignored for devices other than DVDs.
222 \subsection*{Other Points}
223 \index[general]{Points!Other }
224 \index[general]{Other Points }
225 \addcontentsline{toc}{subsection}{Other Points}
228 \item Writing and reading of DVD+RW seems to work quite reliably
229 provided you are using the patched dvd+rw-mediainfo programs.
230 On the other hand, we do not have enough information to ensure
231 that DVD-RW or other forms of DVDs work correctly.
232 \item DVD+RW supports only about 1000 overwrites. Every time you
233 mount the filesystem read/write will count as one write. This can
234 add up quickly, so it is best to mount your DVD+RW filesystem read-only.
235 Bacula does not need the DVD to be mounted read-write, since it uses
236 the raw device for writing.
237 \item Reformatting DVD+RW 10-20 times can apparently make the medium
238 unusable. Normally you should not have to format or reformat
239 DVD+RW media. If it is necessary, current versions of growisofs will
241 \item We have had several problems writing to DVD-RWs (this does NOT
242 concern DVD+RW), because these media have two writing-modes: {\bf
243 Incremental Sequential} and {\bf Restricted Overwrite}. Depending on
244 your device and the media you use, one of these modes may not work
245 correctly (e.g. {\bf Incremental Sequential} does not work with my NEC
246 DVD-writer and Verbatim DVD-RW).
248 To retrieve the current mode of a DVD-RW, run:
250 dvd+rw-mediainfo /dev/xxx
252 where you replace xxx with your DVD device name.
254 {\bf Mounted Media} line should give you the information.
256 To set the device to {\bf Restricted Overwrite} mode, run:
258 dvd+rw-format /dev/xxx
260 If you want to set it back to the default {\bf Incremental Sequential} mode, run:
262 dvd+rw-format -blank /dev/xxx
265 \item Bacula only accepts to write to blank DVDs. To quickly blank a DVD+/-RW, run
268 dd if=/dev/zero bs=1024 count=512 | growisofs -Z /dev/xxx=/dev/fd/0
270 Then, try to mount the device, if it cannot be mounted, it will be considered
271 as blank by Bacula, if it can be mounted, try a full blank (see below).
273 \item If you wish to blank completely a DVD+/-RW, use the following:
275 growisofs -Z /dev/xxx=/dev/zero
277 where you replace xxx with your DVD device name. However, note that this
278 blanks the whole DVD, which takes quite a long time (16 minutes on mine).
279 \item DVD+RW and DVD-RW support only about 1000 overwrites (i.e. don't use the
280 same medium for years if you don't want to have problems...).
282 To write to the DVD the first time use:
284 growisofs -Z /dev/xxx filename
287 To add additional files (more parts use):
290 growisofs -M /dev/xxx filename
293 The option {\bf -use-the-force-luke=4gms} was added in growisofs 5.20 to
294 override growisofs' behavior of always checking for the 4GB limit.
295 Normally, this option is recommended for all Linux kernels 2.6.8 or
296 greater, since these newer kernels can handle writing more than 4GB.
297 See below for more details on this subject.
299 \item For more information about DVD writing, please look at the
300 \elink{dvd+rw-tools homepage}{http://fy.chalmers.se/~appro/linux/DVD+RW/}.