The Storage Daemon configuration file has relatively few resource definitions. However, due to the great variation in backup media and system capabilities, the storage daemon must be highly configurable. As a consequence, there are quite a large number of directives in the Device Resource definition that allow you to define all the characteristics of your Storage device (normally a tape drive). Fortunately, with modern storage devices, the defaults are sufficient, and very few directives are actually needed.
Examples of Device resource directives that are known to work for a number of common tape drives can be found in the <bacula-src>/examples/devices directory, and most will also be listed here.
For a general discussion of configuration file and resources including the data types recognized by Bacula, please see the Configuration chapter of this manual. The following Storage Resource definitions must be defined:
In general, the properties specified under the Storage resource define global properties of the Storage daemon. Each Storage daemon configuration file must have one and only one Storage resource definition.
Typically on Linux systems, you will set this to: /var/run. If you are not installing Bacula in the system directories, you can use the Working Directory as defined above.
SDAddresses = { ip = { addr = 1.2.3.4; port = 1205; } ipv4 = { addr = 1.2.3.4; port = http; } ipv6 = { addr = 1.2.3.4; port = 1205; } ip = { addr = 1.2.3.4 port = 1205 } ip = { addr = 1.2.3.4 } ip = { addr = 201:220:222::2 } ip = { addr = bluedot.thun.net } }
where ip, ip4, ip6, addr, and port are all keywords. Note, that the address can be specified as either a dotted quadruple, or IPv6 colon notation, or as a symbolic name (only in the ip specification). Also, port can be specified as a number or as the mnemonic value from the /etc/services file. If a port is not specified, the default will be used. If an ip section is specified, the resolution can be made either by IPv4 or IPv6. If ip4 is specified, then only IPv4 resolutions will be permitted, and likewise with ip6.
Using this directive, you can replace both the SDPort and SDAddress directives shown below.
The following is a typical Storage daemon Storage definition.
# # "Global" Storage daemon configuration specifications appear # under the Storage resource. # Storage { Name = "Storage daemon" Address = localhost WorkingDirectory = "~/bacula/working" Pid Directory = "~/bacula/working" }
The Director resource specifies the Name of the Director which is permitted to use the services of the Storage daemon. There may be multiple Director resources. The Director Name and Password must match the corresponding values in the Director's configuration file.
Please note that if this director is being used by a Monitor, we highly recommend to set this directive to yes to avoid serious security problems.
The following is an example of a valid Director resource definition:
Director { Name = MainDirector Password = my_secret_password }
The Device Resource specifies the details of each device (normally a tape drive) that can be used by the Storage daemon. There may be multiple Device resources for a single Storage daemon. In general, the properties specified within the Device resource are specific to the Device.
As noted above, normally the Archive Device is the name of a tape drive, but you may also specify an absolute path to an existing directory. If the Device is a directory Bacula will write to file storage in the specified directory, and the filename used will be the Volume name as specified in the Catalog. If you want to write into more than one directory (i.e. to spread the load to different disk drives), you will need to define two Device resources, each containing an Archive Device with a different directory.
In addition to a tape device name or a directory name, Bacula will accept the name of a FIFO. A FIFO is a special kind of file that connects two programs via kernel memory. If a FIFO device is specified for a backup operation, you must have a program that reads what Bacula writes into the FIFO. When the Storage daemon starts the job, it will wait for MaximumOpenWait seconds for the read program to start reading, and then time it out and terminate the job. As a consequence, it is best to start the read program at the beginning of the job perhaps with the RunBeforeJob directive. For this kind of device, you never want to specify AlwaysOpen, because you want the Storage daemon to open it only when a job starts, so you must explicitly set it to No. Since a FIFO is a one way device, Bacula will not attempt to read a label of a FIFO device, but will simply write on it. To create a FIFO Volume in the catalog, use the add command rather than then label command to avoid attempting to write a label.
During a restore operation, if the Archive Device is a FIFO, Bacula will attempt to read from the FIFO, so you must have an external program that writes into the FIFO. Bacula will wait MaximumOpenWait seconds for the program to begin writing and will then time it out and terminate the job. As noted above, you may use the RunBeforeJob to start the writer program at the beginning of the job.
The Archive Device directive is required.
Even though the names you assign are arbitrary (i.e. you choose the name you want), you should take care in specifying them because the Media Type is used to determine which storage device Bacula will select during restore. Thus you should probably use the same Media Type specification for all drives where the Media can be freely interchanged. This is not generally an issue if you have a single Storage daemon, but it is with multiple Storage daemons, especially if they have incompatible media.
For example, if you specify a Media Type of ``DDS-4'' then during the restore, Bacula will be able to choose any Storage Daemon that handles ``DDS-4''. If you have an autochanger, you might want to name the Media Type in a way that is unique to the autochanger, unless you wish to possibly use the Volumes in other drives. You should also ensure to have unique Media Type names if the Media is not compatible between drives. This specification is required for all devices.
Changer Command = "/path/mtx-changer %c %o %S %a %d"
and you will install the mtx on your system (found in the depkgs release). An example of this command is in the default bacula-sd.conf file. For more details on the substitution characters that may be specified to configure your autochanger please see the Autochangers chapter of this manual. For FreeBSD users, you might want to see one of the several chio scripts in examples/autochangers.
Note, it is not necessary to have an autochanger to use this command. The example below uses the tapeinfo program that comes with the mtx package, but it can be used on any tape drive. However, you will need to specify a Changer Device directive in your Device resource (see above) so that the generic SCSI device name can be edited into the command (with the %c).
An example of the use of this command to print Tape Alerts in the Job report is:
Alert Command = "sh -c 'tapeinfo -f %c | grep TapeAlert'"
and an example output when there is a problem could be:
bacula-sd Alert: TapeAlert[32]: Interface: Problem with SCSI interface between tape drive and initiator.
If you have Always Open = yes (recommended) and you want to use the drive for something else, simply use the unmount command in the Console program to release the drive. However, don't forget to remount the drive with mount when the drive is available or the next Bacula job will block.
For File storage, this directive is ignored. For a FIFO storage device, you must set this to No.
Please note that if you set this directive to No Bacula will release the tape drive between each job, and thus the next job will rewind the tape and position it to the end of the data. This can be a very time consuming operation.
To force the block size to be fixed, as is the case for some non-random access devices (tape drives), set the Minimum block size and the Maximum block size to the same value (zero included). The default is that both the minimum and maximum block size are zero and the default block size is 64,512 bytes. If you wish the block size to be fixed and different from the default, specify the same value for both Minimum block size and Maximum block size.
For example, suppose you want a fixed block size of 100K bytes, then you would specify:
Minimum block size = 100K Maximum block size = 100K
Please note that if you specify a fixed block size as shown above, the tape drive must either be in variable block size mode, or if it is in fixed block size mode, the block size (generally defined by mt) must be identical to the size specified in Bacula - otherwise when you attempt to re-read your Volumes, you will get an error.
If you want the block size to be variable but with a 64K minimum and 200K maximum (and default as well), you would specify:
Minimum block size = 64K Maximum blocksize = 200K
If no value is specified or zero is specified, the Storage daemon will use a default block size of 64,512 bytes (126 * 512).
Default setting for Hardware End of Medium is Yes. This function is used before appending to a tape to ensure that no previously written data is lost. We recommend if you have a non standard or unusual tape drive that you use the btape program to test your drive to see whether or not it supports this function. All modern (after 1998) tape drives support this feature.
If you set Hardware End of Medium = no, you should also set Fast Forward Space File = no. If you do not, Bacula will most likely be unable to correctly find the end of data on the tape.
Default setting for Fast Forward Space File is Yes. If you disable Hardware End of Medium, most likely you should also disable Fast Forward Space file. The test command in the program btape will test this feature and advise you if it should be turned off.
For a description of the Messages Resource, please see the Messages Resource Chapter of this manual.
A example Storage Daemon configuration file might be the following:
# # Default Bacula Storage Daemon Configuration file # # For Bacula release 1.35.2 (16 August 2004) -- gentoo 1.4.16 # # You may need to change the name of your tape drive # on the "Archive Device" directive in the Device # resource. If you change the Name and/or the # "Media Type" in the Device resource, please ensure # that bacula-dir.conf has corresponding changes. # Storage { # definition of myself Name = rufus-sd Address = rufus WorkingDirectory = "$HOME/bacula/bin/working" Pid Directory = "$HOME/bacula/bin/working" Maximum Concurrent Jobs = 20 } # # List Directors who are permitted to contact Storage daemon # Director { Name = rufus-dir Password = "ZF9Ctf5PQoWCPkmR3s4atCB0usUPg+vWWyIo2VS5ti6k" } # # Restricted Director, used by tray-monitor to get the # status of the storage daemon # Director { Name = rufus-mon Password = "9usxgc307dMbe7jbD16v0PXlhD64UVasIDD0DH2WAujcDsc6" Monitor = yes } # # Devices supported by this Storage daemon # To connect, the Director's bacula-dir.conf must have the # same Name and MediaType. # Device { Name = "HP DLT 80" Media Type = DLT8000 Archive Device = /dev/nst0 AutomaticMount = yes; # when device opened, read it AlwaysOpen = yes; RemovableMedia = yes; } #Device { # Name = SDT-7000 # # Media Type = DDS-2 # Archive Device = /dev/nst0 # AutomaticMount = yes; # when device opened, read it # AlwaysOpen = yes; # RemovableMedia = yes; #} #Device { # Name = Floppy # Media Type = Floppy # Archive Device = /mnt/floppy # RemovableMedia = yes; # Random Access = Yes; # AutomaticMount = yes; # when device opened, read it # AlwaysOpen = no; #} #Device { # Name = FileStorage # Media Type = File # Archive Device = /tmp # LabelMedia = yes; # lets Bacula label unlabeled media # Random Access = Yes; # AutomaticMount = yes; # when device opened, read it # RemovableMedia = no; # AlwaysOpen = no; #} #Device { # Name = "NEC ND-1300A" # Media Type = DVD # Archive Device = /dev/hda # LabelMedia = yes; # lets Bacula label unlabeled media # Random Access = Yes; # AutomaticMount = yes; # when device opened, read it # RemovableMedia = yes; # AlwaysOpen = no; # MaximumPartSize = 800M; # RequiresMount = yes; # SpoolDirectory = /tmp/backup; #} # # A very old Exabyte with no end of media detection # #Device { # Name = "Exabyte 8mm" # Media Type = "8mm" # Archive Device = /dev/nst0 # Hardware end of medium = No; # AutomaticMount = yes; # when device opened, read it # AlwaysOpen = Yes; # RemovableMedia = yes; #} # # Send all messages to the Director, # mount messages also are sent to the email address # Messages { Name = Standard director = rufus-dir = all operator = root = mount }