Bacula 1.30 User's Guide | Chapter 5.3

Client/File daemon Configuration | Index | Messages Resource

# Storage Daemon Configuration

## General

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 record types 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, very few records are actually needed.

Examples of Device resource records that are known to work for a number of common tape drives can be found in the <bacula-src>/examples/devices directory.

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:

- Storage -- to define the name of the Storage daemon.
- Director -- to define the Director's name and his access password.
- Device -- to define the characteristics of your storage device (tape drive).
- Messages -- to define where error and information messages are to be sent.

## Storage Resource

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.

Name = <Storage-Daemon-Name>
  Specifies the Name of the Storage daemon. This record is required.
Working Directory = <Directory>
  This directive is mandatory and specifies a directory in which the Storage daemon may put its status files. This directory should be used only by Bacula, but may be shared by other Bacula daemons. This record is required
Pid Directory = <Directory>
  This directive is mandatory and specifies a directory in which the Director may put its process Id file files. The process Id file is used to shutdown Bacula and to prevent multiple copies of Bacula from running simultaneously. This record is required. Standard shell expansion of the Directory is done when the configuration file is read so that values such as $HOME will be properly expanded.

  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.

SubSys Directory = <Directory>
  This directive is mandatory and specifies a directory in which the Director may put its subsystem lock files. This record is required. Standard shell expansion of the Directory is done when the configuration file is read so that values such as $HOME will be properly expanded.

  Typically on Linux systems, you will set this to: /var/run/subsys. If you are not installing Bacula in the system directories, you can use the Working Directory as defined above. Take care that you do not set this to the same directory that contains your binary files or they will be deleted.

Maximum Concurrent Jobs = <number>
  where <number> is the maximum number of Jobs that should run concurrently. The default is set to 2, but you may set it to a larger number. Each contact from the Director (e.g. status request, job start request) is considered as a Job, so if you want to be able to do a status request in the console at the same time as a Job is running, you will need to set this value greater than 1.
SDPort = <port-number>
  Specifies port number on which the Storage daemon listens for Director connections. The default is 9103.
SDAddress = <IP-Address>
  This record is optional, and if it is specified, it will cause the Storage daemon server (for Director and File daemon connections) to bind to the specified IP-Address, which is either a domain name or an IP address specified as a dotted quadruple. If this record is not specified, the Storage daemon will bind to any available address (the default).

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"
      SubSys Directory = "~/bacula/working"
    }

## Director Resource

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.

Name = <Director-Name>
  Specifies the Name of the Director allowed to connect to the Storage daemon. This record is required.
Password = <Director-password>
  Specifies the password that must be supplied by the above named Director. This record is required.

The following is an example of a valid Director resource definition:

    Director {
      Name = MainDirector
      Password = my_secret_password
    }

## Device Resource

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.

Name = Device-Name
  Specifies the Name that the Director will use when asking to backup or restore to or from to this device. This is the logical Device name, and may be any string up to 127 characters in length. It is generally a good idea to make it correspond to the English name of the backup device. The physical name of the device is specified on the Archive Device record described below.
Archive Device = name-string
  The specified name-string gives the system file name of the storage device managed by this storage daemon. This will usually be the device file name of a removable storage device (tape drive), for example "/dev/nst0" or "/dev/rmt/0mbn". When specifying a tape device, it is preferable that the "non-rewind" variant of the device file name be given. In addition, on systems such as Sun, which have modified the tape access methods, you must be sure to specify to use Berkeley I/O conventions with the device. The b in the Solaris (Sun) archive specification /dev/rmt/0mbn is what is needed in this case. Bacula does not support SysV tape drive behavior.

  As noted above, normally the Archive Device is the name of a tape drive, but you may also specify a directory name. In that case, 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 record. 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 record is required.

Changer Device = name-string
  The specified name-string gives the system file name of the autochanger device name that corresponds to the Archive Device specified. This device name is specified only if you have an autochanger. Typically, you will want to specify the generic scsi device name. For example, on Linux systems, for archive device /dev/nst0, This record is optional. See the Using Autochangers chapter of this manual for more details of using this and the following autochanger records.

Media Type = name-string
  The specified name-string names the type of media supported by this device, for example, "DLT7000". Media type names are arbitrary in that you set it to anything you want, but must be known to the volume database to keep track of which storage daemons can read which volumes. The same name-string must appear in the appropriate Storage resource definition in the Director's configuration file. This specification is required for all devices.

Autochanger = Yes|No
  If Yes, this device is an automatic tape changer, and you should also specify a Changer Device as well as a Changer Command. If No (default), the volume must be manually changed. You might also want to add an identical record to the Storage resource in the Director's configuration file so that when labeling tapes you are prompted for the slot.

Changer Command = name-string
  The name-string specifies an external program to be called that will automatically change volumes as required by Bacula. There are a number of substitution characters that may be specified to configure your autochanger. For additional details, please see the Autochangers chapter of this manual.

Maximum Changer Wait = time-in-seconds
  This record specifies the maximum time for Bacula to wait for an autochanger to change the volume. If this time is exceeded, Bacula will invalidate the Volume slot number stored in the catalog and try again. If no additional changer volumes exist, Bacula will ask the operator to intervene. The default time out is 120 seconds.

Always Open = Yes|No
  If Yes (default), Bacula will always keep the device open unless specifically unmounted by the Console program. This permits Bacula to ensure that the tape drive is always available. If you set AlwaysOpen to no Bacula will only open the drive when necessary, and at the end of the Job if no other Jobs are using the drive, it will be freed. To minimize unnecessary operator intervention, it is highly recommended that Always Open = yes. This also ensures that the drive is available when Bacula needs it.

  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 record is ignored. For a fifo storage device, you must set this to No.

Maximum Open Wait = time-in-seconds
  This record specifies the maximum amount of time in seconds that Bacula will wait for a device that is busy. The default is 5 minutes. If the device cannot be obtained, the current Job will be terminated in error. Bacula will re-attempt to open the drive the next time a Job starts that needs the the drive.

Removable media = Yes|No
  If Yes, this device supports removable media (for example, tapes or CDs). If No, media cannot be removed (for example, an intermediate backup area on a hard disk).

Random access = Yes|No
  If Yes, the archive device is assumed to be a random access medium which supports the lseek (or lseek64 if Largefile is enabled during configuration) facility.

Maximum block size = size-in-bytes
  The Storage daemon will aways attempt to write blocks of the specified size-in-bytes to the archive device. As a consequence, this statement specifies both the default block size and the maximum block size. The size written never exceed the given size-in-bytes. If adding data to a block would cause it to exceed the given maximum size, the block will be written to the archive device, and the new data will begin a new block.

  If no value is specified or zero is specified, the Storage daemon will use a default block size of 64,512 bytes (126 * 512).

Minimum block size = size-in-bytes
  This statement applies only to non-random access devices (e.g. tape drives). Blocks written by the storage daemon to a non-random archive device will never be smaller than the given size-in-bytes. The Storage daemon will attempt to efficiently fill blocks with data received from active sessions but will, if necessary, add padding to a block to achieve the required minimum size.

  To force the block size to be fixed, as is normally the case for 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

  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

Hardware End of Medium = Yes|No
  If No, the archive device is not required to support end of medium ioctl request, and the storage daemon will use the forward space file function to find the end of the recorded data. If Yes, the archive device must support the `ioctl` `MTEOM` call, which will position the tape to the end of the recorded data. Default 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.

Backward Space Record = Yes|No
  If Yes, the archive device supports the `MTBSR ioctl` to backspace records. If No, this call is not used and the device must be rewound and advanced forward to the desired position. Default is Yes for non random-access devices.

Backward Space File = Yes|No
  If Yes, the archive device supports the MTBSF and MTBSF ioctls to backspace over an end of file mark and to the start of a file. If No, these calls are not used and the device must be rewound and advanced forward to the desired position. Default is Yes for non random-access devices.

Forward Space Record = Yes|No
  If Yes, the archive device must support the MTFSR ioctl to forward space over records. If No, data must be read in order to advance the position on the device. Default is Yes for non random-access devices.

Forward Space File = Yes|No
  If Yes, the archive device must support the `MTFSF ioctl` to forward space by file marks. If No, data must be read to advance the position on the device. Default is Yes for non random-access devices.

Offline On Unmount = Yes|No
  The default for this record is No. If Yes the archive device must support the `MTOFFL ioctl` to rewind and take the volume offline. In this case, Bacula will issue the offline (eject) request before closing the device during the unmount command. If No Bacula will not attempt to offline the device before unmounting it. After an offline is issued, the cassette will be ejected thus requiring operator intervention to continue. If you are using an autochanger, some devices require an offline to be issued prior to changing the volume.

Maximum Volume Size = size
  No more than size bytes will be written onto a given volume on the archive device. This record is used mainly in testing Bacula to simulate a small Volume. It can also be useful if you wish to limit the size of a File Volume to say less than 2GB of data. In some rare cases of really antiquated tape drives that do not properly indicate when the end of a tape is reached during writing (though I have read about such drives, I have never personally encountered one). Please note, this record is deprecated (being phased out) in favor of the Maximum Volume Bytes defined in the Director's configuration file.

Maximum File Size = size
  No more than size bytes will be written into a given logical file on the volume. Once this size is reached, an end of file mark is written on the volume and subsequent data are written into the next file. Breaking long sequences of data blocks with file marks permits quicker positioning to the start of a given stream of data and can improve recovery from read errors on the volume.

## Parallelism

Maximum Concurrent Jobs = positive integer
  The storage daemon will accept no more than the given positive integer of simultaneous connections. The default is 2 so that you may have either two simultaneous jobs running or one job and one status connection. It is probably best to set this number fairly large (e.g. 10 or 20) and control how many Jobs are running with the Maximum Concurrent Jobs record in the Director's configuration file.

## Capabilities

Label media = Yes|No
  If Yes, permits this device to automatically label blank media without an explicit operator command. It does so by using an internal algorithm as defined in each Pool resource. If this is No as by default, Bacula will label tapes only by specific operator command (label) or when the tape has been recycled.

Automatic mount = Yes|No
  If Yes (the default), permits the daemon to examine the device to determine if it contains a Bacula labeled volume. This is done initially when the daemon is started, and then at the beginning of each job. This record is particularly important if you have set Always Open = no because it permits Bacula to attempt to read the device before asking the system operator to mount a tape.

## Messages Resource

For a description of the Messages Resource, please see the Messages Resource Chapter of this manual.

## Sample Storage Daemon Configuration File

A example Storage Daemon configuration file might be the following:

    #
    # Default Bacula Storage Daemon Configuration file
    #
    #  For Bacula release 1.15 (5 March 2002) -- redhat 7.1
    #
    # 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"
      Subsys Directory = "$HOME/bacula/bin/working"
    }

    #
    # List Directors who are permitted to contact Storage daemon
    #
    Director {
      Name = rufus-dir
      Password = "ZF9Ctf5PQoWCPkmR3s4atCB0usUPg+vWWyIo2VS5ti6k"
    }

    #
    # 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 unlabelled media
    #  Random Access = Yes;
    #  AutomaticMount = yes;               # when device opened, read it
    #  RemovableMedia = no;
    #  AlwaysOpen = no;
    #}

    #
    # 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
    }

Client/File daemon Configuration | Index | Messages Resource

Bacula 1.30 User's Guide The Network Backup Solution | Copyright © 2000-2003 Kern Sibbald and John Walker