%%
%%

\section*{DVD Volumes}
\label{_DVDChapterStart}
\index[general]{DVD Volumes}
\index[general]{Writing DVDs}
\index[general]{DVD Writing}
\index[general]{Volumes!DVD}
\addcontentsline{toc}{section}{DVD Volumes}

Bacula allows you to specify that you want to write to DVD. However,
this feature is implemented only in version 1.37 or later.
You may in fact write to DVD+RW, DVD+R, DVD-R, or DVD-RW 
media. The actual process used by Bacula is to first write
the image to a spool directory, then when the Volume reaches
a certain size or,  at your option, at the end of a Job, Bacula
will transfer the image from the spool directory to the
DVD.  The actual work of transferring the image is done
by a script {\bf dvd-writepart}, and the heart of that
script is a program called {\bf growisofs} which allows
creating or adding to a DVD ISO filesystem. growisofs is
normally found in the {\bf dvd+rw-tools} package or rpm.
You must have it loaded on your system for DVD writing to
work.

The fact that Bacula cannot use the OS to write directly
to the DVD makes the whole process a bit more error prone than
writing to say a disk, but nevertheless, it does work if you
use some care to set it up properly.

The remainder of this chapter explains the various directives that you can
use to control the DVD writing.

\label{DVDdirectives}

\subsection*{DVD Specific SD Directives} 
\index[general]{Directives!DVD}
\index[general]{DVD Specific SD Directives }
\addcontentsline{toc}{subsection}{DVD Specific SD Directives}

The following directives are added to the Storage daemon's
Device resource.

\begin{description}

\item [Requires Mount = {\it Yes|No}]
   \index[sd]{Requires Mount  }
   You must set this directive to {\bf yes} for DVD-writers,  and to {\bf no} for
   all other devices (tapes/files).  This directive indicates if the device
   requires to be mounted to be read,  and if it must be written in a special way.
   If it set, {\bf Mount Point},  {\bf Mount Command}, {\bf Unmount Command} and
   {\bf Write Part Command}  directives must also be defined. 

\item [Mount Point = {\it directory}]
   \index[sd]{Mount Point  }
   Directory where the device can be mounted. 

\item [Mount Command = {\it name-string}]
   \index[sd]{Mount Command  }
   Command that must be executed to mount the device. Although the
   device is written directly, the mount command is necessary in
   order to determine the free space left on the DVD. Before the command is 
   executed, \%a is replaced with the Archive Device, and \%m with the Mount 
   Point.

   Most frequently, you will define it as follows:  

\footnotesize
\begin{verbatim}
  Mount Command = "/bin/mount -t iso9660 -o ro %a %m"
\end{verbatim}
\normalsize

\item [Unmount Command = {\it name-string}]
   \index[sd]{Unmount Command  }
   Command that must be executed to unmount the device. Before the command  is
   executed, \%a is replaced with the Archive Device, and \%m with the  Mount
   Point.

   Most frequently, you will define it as follows:  

\footnotesize
\begin{verbatim}
  Unmount Command = "/bin/umount %m"
\end{verbatim}
\normalsize

\item [Write Part Command = {\it name-string}]
   \index[sd]{Write Part Command  }
   Command that must be executed to write a part to the device. Before the 
   command is executed, \%a is replaced with the Archive Device, \%m with the 
   Mount Point, \%n with the current part number (0-based), and \%v with the 
   current part filename.

   For a DVD, you will most frequently specify the Bacula supplied  {\bf
   dvd-writepart} script as follows:  

\footnotesize
\begin{verbatim}
  Write Part Command = "/path/dvd-writepart %n %a %v"
\end{verbatim}
\normalsize

  Where {\bf /path} is the path to your scripts install directory, and
  dvd-writepart is the Bacula supplied script file.  
  This command will already be present, but commented out,
  in the default bacula-sd.conf file. To use it, simply remove
  the comment (#) symbol.


\item [Free Space Command = {\it name-string}]
   \index[sd]{Free Space Command  }
   Command that must be executed to check how much free space is left on the 
   device. Before the command is executed, \%a is replaced with the Archive 
   Device, \%m with the Mount Point, \%n with the current part number (0-based), 
   and \%v with the current part filename.

   For a DVD, you will most frequently specify the Bacula supplied  {\bf
   dvd-freespace} script as follows:  

\footnotesize
\begin{verbatim}
  Free Space Command = "/path/dvd-freespace %n %a"
\end{verbatim}
\normalsize

  Where {\bf /path} is the path to your scripts install directory, and
  dvd-freespace is the Bacula supplied script file.
  If you want to specify your own command, please look at the code in
  dvd-freespace to see what output Bacula expects from this command.
  This command will already be present, but commented out,
  in the default bacula-sd.conf file. To use it, simply remove
  the comment (#) symbol.

  If you do not set it, Bacula will expect there is always free space on the
  device. 

\end{description}

In addition to the directives specified above, you must also
specify the other standard Device resource directives. Please see the
sample DVD Device resource in the default bacula-sd.conf file. Be sure
to specify the raw device name for {\bf Archive Device}. It should 
be a name such as {\bf /dev/cdrom} or {\bf /media/cdrecorder} or
{\bf /dev/dvd} depending on your system.  It will not be a name such
as {\bf /mnt/cdrom}.


\subsection*{DVD Specific Director Directives} 
\index[general]{Directives!DVD}
\index[general]{DVD Specific Director Directives }
\addcontentsline{toc}{subsection}{DVD Specific Director Directives}

The following directives are added to the Director's Job resource.
    
\label{WritePartAfterJob}
\item [Write Part After Job = \lt{}yes|no\gt{}]
   \index[dir]{Write Part After Job }
   If this directive is set to {\bf yes} (default {\bf no}), the
   Volume written to a temporary spool file for the current Job will
   be written to the DVD as a new part file
   will be created after the job is finished.  

   It should be set to {\bf yes} when writing to devices that require a mount
   (for example DVD), so you are sure that the current part, containing
   this job's data, is written to the device, and that no data is left in
   the temporary file on the hard disk.  However, on some media, like DVD+R
   and DVD-R, a lot of space (about 10Mb) is lost everytime a part is
   written.  So, if you run several jobs each after another, you could set
   this directive to {\bf no} for all jobs, except the last one, to avoid
   wasting too much space, but to ensure that the data is written to the
   medium when all jobs are finished.

   It is ignored with tape and FIFO devices.  
\end{description}



\label{DVDpoints}
\subsection*{Other Points}
\index[general]{Points!Other }
\index[general]{Other Points }
\addcontentsline{toc}{subsection}{Other Points}

\begin{itemize}
\item DVD+RW supports only about 1000 overwrites, so every time you
   mount the filesystem read/write will count as one write. This can
   add up quickly, so it is best to mount your DVD+RW filesystem read-only.
   Bacula does not need the DVD to be mounted read-write, since it uses
   the raw device for writing.
\item Reformating DVD+RW 10-20 time can apparently make the medium 
   unusable. Normally you should not have to format or reformat
   DVD+RW media. If it is necessary, current versions of growisofs will
   do so automatically.
\item If you wish to blank your DVD, use the following:
\begin{verbatim}
  growisofs -Z /dev/xxx=/dev/zero
\end{verbatim}
  where you replace xxx with your DVD device name. However, note that this
  blanks the whole DVD, which takes quite a long time (16 minutes on mine).
\end{itemize}
