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 dvd-writepart, and the heart of that script is a program called growisofs which allows creating or adding to a DVD ISO filesystem. growisofs is normally found in the 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.
The following directives are added to the Storage daemon's Device resource.
Most frequently, you will define it as follows:
Mount Command = "/bin/mount -t iso9660 -o ro %a %m"
Most frequently, you will define it as follows:
Unmount Command = "/bin/umount %m"
For a DVD, you will most frequently specify the Bacula supplied dvd-writepart script as follows:
Write Part Command = "/path/dvd-writepart %e %a %v"
Where /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.
For a DVD, you will most frequently specify the Bacula supplied dvd-freespace script as follows:
Free Space Command = "/path/dvd-freespace %a"
Where /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.
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 Archive Device. It should be a name such as /dev/cdrom or /media/cdrecorder or /dev/dvd depending on your system. It will not be a name such as /mnt/cdrom.
The following directives are added to the Director's Job resource.
It should be set to 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 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.
To retrieve the current mode of a DVD-RW, run:
dvd+rw-mediainfo /dev/xxxwhere you replace xxx with your DVD device name.
Mounted Media line should give you the information.
To set the device to Restricted Overwrite mode, run:
dvd+rw-format /dev/xxxIf you want to set it back to the default Incremental Sequential mode, run:
dvd+rw-format -blank /dev/xxx
dd if=/dev/zero bs=1024 count=512 | growisofs -Z /dev/xxx=/dev/fd/0Then, try to mount the device, if it cannot be mounted, it will be considered as blank by Bacula, if it can be mounted, try a full blank (see below).
growisofs -Z /dev/xxx=/dev/zerowhere 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).