#
# Default Bacula Storage Daemon Configuration file
#
#  For Bacula release 9.6.7 (10 December 2020) -- ubuntu 23.04
#
# 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 dird.conf has corresponding changes.
#
#
# Copyright (C) 2000-2020 Kern Sibbald
# License: BSD 2-Clause; see file LICENSE-FOSS
#

Storage {                             # definition of myself
  Name = server01-sd
  SDPort = 9103                  # Director's port
  WorkingDirectory = "/var/lib/bacula"
  Pid Directory = "/run/bacula"
  Plugin Directory = "/usr/lib/bacula"
  Maximum Concurrent Jobs = 20
  SDAddress = server01.example.com
}

#
# List Directors who are permitted to contact Storage daemon
#
Director {
  Name = server01-dir
  Password = "ngjSVzpAE_GR6Odg7mWPoYzJnNc4vtm1-"
}

#
# Restricted Director, used by tray-monitor to get the
#   status of the storage daemon
#
Director {
  Name = server01-mon
  Password = "qCSTt-wE4mFkPV609G5hkZlAAXSZxZozw"
  Monitor = yes
}

#
# Note, for a list of additional Device templates please
#  see the directory <bacula-source>/examples/devices
# Or follow the following link:
#  http://www.bacula.org/git/cgit.cgi/bacula/tree/bacula/examples/devices?h=Branch-7.4
#

#
# Devices supported by this Storage daemon
# To connect, the Director's bacula-dir.conf must have the
#  same Name and MediaType.
#

# vchanger Autochanger vchanger0 with 5 virtual devices
Autochanger {
        Name = usb-vchanger0
        Device = usb-vchanger0-drive-0
        Device = usb-vchanger0-drive-1
        Device = usb-vchanger0-drive-2
        Device = usb-vchanger0-drive-3
        Device = usb-vchanger0-drive-4
        Changer Command = "/usr/local/bin/vchanger %c %o %S %a %d"
        Changer Device = "/etc/vchanger/vchanger0.conf"
}

# Define The Virtual Devices For vchanger0
Device {
        Name = usb-vchanger0-drive-0
        Drive Index = 0
        Autochanger = yes;
        Device Type = File
        Media Type = File
        Automatic Mount = yes;
        Always Open = yes;
        Automatic Mount = yes;
        Always Open = yes;
        Removable Media = yes;
        Random Access = yes;
        Label media = yes;
        Maximum Concurrent Jobs = 1
        Volume Poll Interval = 15
        Archive Device = "/usr/local/var/spool/vchanger/vchanger0/0"
        Alert Command = "sh -c 'smartctl -H -l error %c'"
        # Alert Command = "/etc/bacula/scripts/tapealert %1; sh -c 'smartctl -H -l error %c'"
}

Device {
        Name = usb-vchanger0-drive-1
        Drive Index = 1
        Autochanger = yes;
        Device Type = File
        Media Type = File
        Automatic Mount = yes;
        Always Open = yes;
        Automatic Mount = yes;
        Always Open = yes;
        Removable Media = yes;
        Random Access = yes;
        Label media = yes;
        Maximum Concurrent Jobs = 1
        Volume Poll Interval = 15
        Archive Device = "/usr/local/var/spool/vchanger/vchanger0/1"
        Alert Command = "sh -c 'smartctl -H -l error %c'"
        # Alert Command = "/etc/bacula/scripts/tapealert %1; sh -c 'smartctl -H -l error %c'"
}

Device {
        Name = usb-vchanger0-drive-2
        Drive Index = 2
        Autochanger = yes;
        Device Type = File
        Media Type = File
        Automatic Mount = yes;
        Always Open = yes;
        Automatic Mount = yes;
        Always Open = yes;
        Removable Media = yes;
        Random Access = yes;
        Label media = yes;
        Maximum Concurrent Jobs = 1
        Volume Poll Interval = 15
        Archive Device = "/usr/local/var/spool/vchanger/vchanger0/2"
        Alert Command = "sh -c 'smartctl -H -l error %c'"
        # Alert Command = "/etc/bacula/scripts/tapealert %1; sh -c 'smartctl -H -l error %c'"
}

Device {
        Name = usb-vchanger0-drive-3
        Drive Index = 3
        Autochanger = yes;
        Device Type = File
        Media Type = File
        Automatic Mount = yes;
        Always Open = yes;
        Automatic Mount = yes;
        Always Open = yes;
        Removable Media = yes;
        Random Access = yes;
        Label media = yes;
        Maximum Concurrent Jobs = 1
        Volume Poll Interval = 15
        Archive Device = "/usr/local/var/spool/vchanger/vchanger0/3"
        Alert Command = "sh -c 'smartctl -H -l error %c'"
        # Alert Command = "/etc/bacula/scripts/tapealert %1; sh -c 'smartctl -H -l error %c'"
}

Device {
        Name = usb-vchanger0-drive-4
        Drive Index = 4
        Autochanger = yes;
        Device Type = File
        Media Type = File
        Automatic Mount = yes;
        Always Open = yes;
        Automatic Mount = yes;
        Always Open = yes;
        Removable Media = yes;
        Random Access = yes;
        Label media = yes;
        Maximum Concurrent Jobs = 1
        Volume Poll Interval = 15
        Archive Device = "/usr/local/var/spool/vchanger/vchanger0/4"
        Alert Command = "sh -c 'smartctl -H -l error %c'"
        # Alert Command = "/etc/bacula/scripts/tapealert %1; sh -c 'smartctl -H -l error %c'"
}

#
# An autochanger device with two drives
#
#Autochanger {
#  Name = Autochanger
#  Device = Drive-1
#  Device = Drive-2
#  Changer Command = "/etc/bacula/scripts/mtx-changer %c %o %S %a %d"
#  Changer Device = /dev/sg0
#}

#Device {
#  Name = Drive-1                      #
#  Drive Index = 0
#  Media Type = DLT-8000
#  Archive Device = /dev/nst0
#  AutomaticMount = yes;               # when device opened, read it
#  AlwaysOpen = yes;
#  RemovableMedia = yes;
#  RandomAccess = no;
#  AutoChanger = yes
#  #
#  # New alert command in Bacula 9.0.0
#  #  Note: you must have the sg3_utils (rpms) or the
#  #        sg3-utils (deb) installed on your system.
#  #        and you must set the correct control device that
#  #        corresponds to the Archive Device
#  Control Device = /dev/sg?? # must be SCSI ctl for /dev/nst0
#  Alert Command = "/etc/bacula/scripts/tapealert %l"
#
#  #
#  # Enable the Alert command only if you have the mtx package loaded
#  # Note, apparently on some systems, tapeinfo resets the SCSI controller
#  #  thus if you turn this on, make sure it does not reset your SCSI
#  #  controller.  I have never had any problems, and smartctl does
#  #  not seem to cause such problems.
#  #
#  Alert Command = "sh -c 'tapeinfo -f %c |grep TapeAlert|cat'"
#  If you have smartctl, enable this, it has more info than tapeinfo
#  Alert Command = "sh -c 'smartctl -H -l error %c'"
#}

#Device {
#  Name = Drive-2                      #
#  Drive Index = 1
#  Media Type = DLT-8000
#  Archive Device = /dev/nst1
#  AutomaticMount = yes;               # when device opened, read it
#  AlwaysOpen = yes;
#  RemovableMedia = yes;
#  RandomAccess = no;
#  AutoChanger = yes
#  # Enable the Alert command only if you have the mtx package loaded
#  Alert Command = "sh -c 'tapeinfo -f %c |grep TapeAlert|cat'"
#  If you have smartctl, enable this, it has more info than tapeinfo
#  Alert Command = "sh -c 'smartctl -H -l error %c'"
#}

#
# A Linux or Solaris LTO-2 tape drive
#
#Device {
#  Name = LTO-2
#  Media Type = LTO-2
#  Archive Device = /dev/nst0
#  AutomaticMount = yes;               # when device opened, read it
#  AlwaysOpen = yes;
#  RemovableMedia = yes;
#  RandomAccess = no;
#  Maximum File Size = 3GB
## Changer Command = "/etc/bacula/scripts/mtx-changer %c %o %S %a %d"
## Changer Device = /dev/sg0
## AutoChanger = yes
#  # Enable the Alert command only if you have the mtx package loaded
## Alert Command = "sh -c 'tapeinfo -f %c |grep TapeAlert|cat'"
## If you have smartctl, enable this, it has more info than tapeinfo
## Alert Command = "sh -c 'smartctl -H -l error %c'"
#}

#
# A Linux or Solaris LTO-3 tape drive
#
#Device {
#  Name = LTO-3
#  Media Type = LTO-3
#  Archive Device = /dev/nst0
#  AutomaticMount = yes;               # when device opened, read it
#  AlwaysOpen = yes;
#  RemovableMedia = yes;
#  RandomAccess = no;
#  Maximum File Size = 4GB
# Changer Command = "/etc/bacula/scripts/mtx-changer %c %o %S %a %d"
# Changer Device = /dev/sg0
# AutoChanger = yes
#  #
#  # New alert command in Bacula 9.0.0
#  #  Note: you must have the sg3_utils (rpms) or the
#  #        sg3-utils (deb) installed on your system.
#  #        and you must set the correct control device that
#  #        corresponds to the Archive Device
#  Control Device = /dev/sg??  # must be SCSI ctl for /dev/nst0
#  Alert Command = "/etc/bacula/scripts/tapealert %l"
#
#  # Enable the Alert command only if you have the mtx package loaded
## Alert Command = "sh -c 'tapeinfo -f %c |grep TapeAlert|cat'"
## If you have smartctl, enable this, it has more info than tapeinfo
## Alert Command = "sh -c 'smartctl -H -l error %c'"
#}

#
# A Linux or Solaris LTO-4 tape drive
#
#Device {
#  Name = LTO-4
#  Media Type = LTO-4
#  Archive Device = /dev/nst0
#  AutomaticMount = yes;               # when device opened, read it
#  AlwaysOpen = yes;
#  RemovableMedia = yes;
#  RandomAccess = no;
#  Maximum File Size = 5GB
# Changer Command = "/etc/bacula/scripts/mtx-changer %c %o %S %a %d"
# Changer Device = /dev/sg0
# AutoChanger = yes
#  #
#  # New alert command in Bacula 9.0.0
#  #  Note: you must have the sg3_utils (rpms) or the
#  #        sg3-utils (deb) installed on your system.
#  #        and you must set the correct control device that
#  #        corresponds to the Archive Device
#  Control Device = /dev/sg??  # must be SCSI ctl for /dev/nst0
#  Alert Command = "/etc/bacula/scripts/tapealert %l"
#
#  # Enable the Alert command only if you have the mtx package loaded
## Alert Command = "sh -c 'tapeinfo -f %c |grep TapeAlert|cat'"
## If you have smartctl, enable this, it has more info than tapeinfo
## Alert Command = "sh -c 'smartctl -H -l error %c'"
#}

#
# An HP-UX tape drive
#
#Device {
#  Name = Drive-1                      #
#  Drive Index = 0
#  Media Type = DLT-8000
#  Archive Device = /dev/rmt/1mnb
#  AutomaticMount = yes;               # when device opened, read it
#  AlwaysOpen = yes;
#  RemovableMedia = yes;
#  RandomAccess = no;
#  AutoChanger = no
#  Two EOF = yes
#  Hardware End of Medium = no
#  Fast Forward Space File = no
#  #
#  # New alert command in Bacula 9.0.0
#  #  Note: you must have the sg3_utils (rpms) or the
#  #        sg3-utils (deb) installed on your system.
#  #        and you must set the correct control device that
#  #        corresponds to the Archive Device
#  Control Device = /dev/sg??  # must be SCSI ctl for /dev/rmt/1mnb
#  Alert Command = "/etc/bacula/scripts/tapealert %l"
#
#  #
#  # Enable the Alert command only if you have the mtx package loaded
#  Alert Command = "sh -c 'tapeinfo -f %c |grep TapeAlert|cat'"
#  If you have smartctl, enable this, it has more info than tapeinfo
#  Alert Command = "sh -c 'smartctl -H -l error %c'"
#}

#
# A FreeBSD tape drive
#
#Device {
#  Name = DDS-4
#  Description = "DDS-4 for FreeBSD"
#  Media Type = DDS-4
#  Archive Device = /dev/nsa1
#  AutomaticMount = yes;               # when device opened, read it
#  AlwaysOpen = yes
#  Offline On Unmount = no
#  Hardware End of Medium = no
#  BSF at EOM = yes
#  Backward Space Record = no
#  Fast Forward Space File = no
#  TWO EOF = yes
#  #
#  # New alert command in Bacula 9.0.0
#  #  Note: you must have the sg3_utils (rpms) or the
#  #        sg3-utils (deb) installed on your system.
#  #        and you must set the correct control device that
#  #        corresponds to the Archive Device
#  Control Device = /dev/sg??  # must be SCSI ctl for /dev/nsa1
#  Alert Command = "/etc/bacula/scripts/tapealert %l"
#
#  If you have smartctl, enable this, it has more info than tapeinfo
#  Alert Command = "sh -c 'smartctl -H -l error %c'"
#}

#
# Send all messages to the Director,
# mount messages also are sent to the email address
#
Messages {
  Name = Standard
  director = server01-dir = all
}
