Hi! I want to replace Arkeia 4 with bacula 1.36.3 running on a Solaris 2.6 machine with a HP C5713A DDS 4 autochanger. I think I've already managed to configure everything but bacula failes very often because it's not able to run mtx-changer properly. It looks like the device is busy. I'm using /dev/rmt/0cbn for the archive and the control device. I hope that's okay?
I've attached my configuration files and my slightly modified mtx-changer script (only changed the first line from /bin/sh to /bin/ksh). Thanks for any support, Alex. -- Alexander Löhr Senior Software Engineer Zuken Technology-Center Vattmannstr. 3 33100 Paderborn Germany Tel: +49-5251-150-622 Fax: +49-5251-150-700 Email: [EMAIL PROTECTED] Web: www.zuken.com Skype: alexander.loehr_ PGP key: http://mail.pad.zuken.de/~alex/aloehr.asc _____________________________________________ This message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information. If you have received it in error, please notify the sender immediately and delete the original. Any other use of the email by you is prohibited.
#!/bin/ksh # # Bacula interface to mtx autoloader # # $Id: mtx-changer.in,v 1.11.2.1 2004/11/05 21:53:52 kerns Exp $ # # If you set in your Device resource # # Changer Command = "path-to-this-script/mtx-changer" %c %o %S %a %d # you will have the following input to this script: # # mtx-changer "changer-device" "command" "slot" "archive-device" "drive-index" # $1 $2 $3 $4 $5 # # for example: # # mtx-changer /dev/sg0 load 1 /dev/nst0 0 (on a Linux system) # # If you need to an offline, refer to the drive as $4 # e.g. mt -f $4 offline # # Many changers need an offline after the unload. Also many # changers need a sleep 60 after the mtx load. # # N.B. If you change the script, take care to return either # the mtx exit code or a 0. If the script exits with a non-zero # exit code, Bacula will assume the request failed. # MTX=/opt/bacula-1.36.3/bin/mtx # # The purpose of this function to wait a maximum # time for the drive. It will # return as soon as the drive is ready, or after # waiting a maximum of 180 seconds. # Note, this is very system dependent, so if you are # not running on Linux, you will probably need to # re-write it. # # If you have a FreeBSD system, you might want to change # the $(seq 180) to $(jot 180) -- tip from Brian McDonald # wait_for_drive() { for i in $(seq 180); do # Wait max 180 seconds if mt -f $1 status | grep ONLINE >/dev/null 2>&1; then break fi # echo "Device $1 - not ready, retrying..." sleep 1 done } if test $# -lt 2 ; then echo "usage: mtx-changer ctl-device command slot archive-device drive" echo " Insufficient number of arguments arguments given." echo " Mimimum usage is first two arguments ..." exit 1 fi # Setup arguments ctl=$1 cmd="$2" slot=$3 device=$4 # If drive not given, default to 0 if test $# = 5 ; then drive=$5 else drive=0 fi # # Check for special cases where only 2 arguments are needed, # all others are a minimum of 3 case $cmd in loaded) ;; unload) ;; list) ;; slots) ;; *) if test $# -lt 3; then echo "usage: mtx-changer ctl-device command slot archive-device drive" echo " Insufficient number of arguments arguments given." echo " Mimimum usage is first three arguments ..." exit 1 fi ;; esac case $cmd in unload) # echo "Doing mtx -f $ctl unload $slot $drive" # # enable the following line if you need to eject the cartridge # mt -f $device offline if test x$slot = x; then ${MTX} -f $ctl unload else ${MTX} -f $ctl unload $slot $drive fi ;; load) # echo "Doing mtx -f $ctl load $slot $drive" ${MTX} -f $ctl load $slot $drive rtn=$? # # Increase the sleep time if you have a slow device # or remove the sleep and add the following: # wait_for_drive $device sleep 15 exit $rtn ;; list) # echo "Requested list" ${MTX} -f $ctl status | grep " *Storage Element [0-9]*:.*Full" | awk "{print \$3 \$4}" | sed "s/Full *\(:VolumeTag=\)*//" # Comment out the previous line and add a line here # to print "fake" barcodes. # # If you have a VXA PacketLoader and the above does not work, try # turning it off and enabling the following line. # ${MTX} -f $ctl status | grep " *Storage Element [0-9]*:.*Full" | sed "s/*Storage Element //" | sed "s/Full :VolumeTag=//" ;; loaded) ${MTX} -f $ctl status >/tmp/mtx.$$ rtn=$? cat /tmp/mtx.$$ | grep "^Data Transfer Element $drive:Full" | awk "{print \$7}" cat /tmp/mtx.$$ | grep "^Data Transfer Element $drive:Empty" | awk "{print 0}" rm -f /tmp/mtx.$$ exit $rtn ;; slots) # echo "Request slots" ${MTX} -f $ctl status | grep " *Storage Changer" | awk "{print \$5}" ;; esac
# # Default Bacula Director Configuration file # # The only thing that MUST be changed is to add one or more # file or directory names in the Include directive of the # FileSet resource. # # For Bacula release 1.36.3 (22 April 2005) -- solaris 5.6 # # You might also want to change the default email address # from root to your address. See the "mail" and "operator" # directives in the Messages resource. # Director { # define myself Name = achernar-dir DIRport = 9101 # where we listen for UA connections QueryFile = "/opt/bacula-1.36.3/etc/query.sql" WorkingDirectory = "/opt/bacula-1.36.3/var" PidDirectory = "/opt/bacula-1.36.3/var" Maximum Concurrent Jobs = 1 Password = "XXX" Messages = Daemon } FileSet { Name = "Magellan:ConfigSWNotebooks" Include { Options { signature = MD5 } File = /etc File = /var/yp File = /var/openldap File = /var/cron File = /raid/usr/zuken File = /export/magellan_1 } } FileSet { Name = "Magellan:ConfigHome" Include { Options { signature = MD5 } File = /etc File = /var/yp File = /var/openldap File = /var/cron File = /raid/home } # Exclude { # File = "|/opt/bacula-1.36.3/bin/list_opb_nobackup /globals/home /raid/home" # } } JobDefs { Name = MagellanDefs Type = Backup Level = Incremental Client = magellan-fd Storage = DDS-4 Messages = Standard Priority = 10 Pool = Default } Job { Name = "Magellan:ConfigHomeMonth" JobDefs = MagellanDefs Level = Full FileSet = "Magellan:ConfigHome" Schedule = "Magellan:ConfigHomeMonth" Pool = Month } Schedule { Name = "Magellan:ConfigHomeMonth" Run = 1st fri at 20:00 } Job { Name = "Magellan:ConfigHome" JobDefs = MagellanDefs FileSet = "Magellan:ConfigHome" Schedule = "Magellan:ConfigHome" } Schedule { Name = "Magellan:ConfigHome" Run = Level=Full 2nd-5th fri at 20:00 Run = tue-thu at 20:00 } Job { Name = "Magellan:ConfigSWNotebooksMonth" JobDefs = MagellanDefs Level = Full FileSet = "Magellan:ConfigSWNotebooks" Schedule = "Magellan:ConfigSWNotebooksMonth" Pool = Month } Schedule { Name = "Magellan:ConfigSWNotebooksMonth" Run = 1st mon at 20:00 } Job { Name = "Magellan:ConfigSWNotebooks" JobDefs = MagellanDefs Level = Full FileSet = "Magellan:ConfigSWNotebooks" Schedule = "Magellan:ConfigSWNotebooks" } Schedule { Name = "Magellan:ConfigSWNotebooks" Run = 2nd-5th mon at 20:00 } #Job { # Name = "BackupCatalog" # Client = achernar-fd # Level = Full # FileSet = Catalog #Schedule = "WeeklyCycleAfterBackup" # This creates an ASCII copy of the catalog # RunBeforeJob = "/opt/bacula-1.36.3/etc/make_catalog_backup bacula bacula" # This deletes the copy of the catalog # RunAfterJob = "/opt/bacula-1.36.3/etc/delete_catalog_backup" # Priority = 11 # run after main backup #} # Standard Restore template, to be changed by Console program Job { Name = "RestoreFiles" Type = Restore Client=magellan-fd FileSet="Magellan:ConfigHome" Storage = DDS-4 Pool = Default Messages = Standard Where = /tmp/bacula-restores } # This is the backup of the catalog FileSet { Name = "Catalog" Include { Options { signature = MD5 } File = /opt/bacula-1.36.3/var/bacula.sql } } # Client (File Services) to backup Client { Name = achernar-fd Address = achernar FDPort = 9102 Catalog = MyCatalog Password = "XXX" File Retention = 30 days # 30 days Job Retention = 6 months # six months AutoPrune = yes # Prune expired Jobs/Files } Client { Name = magellan-fd Address = magellan FDPort = 9102 Catalog = MyCatalog Password = "XXX" File Retention = 30 days # 30 days Job Retention = 6 months # six months AutoPrune = yes # Prune expired Jobs/Files } # Definiton of file storage device Storage { Name = File # Do not use "localhost" here Address = achernar # N.B. Use a fully qualified name here SDPort = 9103 Password = "XXX" Device = FileStorage Media Type = File } # Definition of DDS tape storage device Storage { Name = DDS-4 # Do not use "localhost" here Address = achernar # N.B. Use a fully qualified name here SDPort = 9103 Password = "XXX" Device = DDS-4 # must be same as Device in Storage daemon Media Type = DDS-4 # must be same as MediaType in Storage daemon Autochanger = yes } # Definition of 8mm tape storage device #Storage { # Name = "8mmDrive" # Do not use "localhost" here # Address = achernar # N.B. Use a fully qualified name here # SDPort = 9103 # Password = "5I9MaeuyyDpraFLtQN1FO12pgkDXW4lh/1Xo4qtR0rOa" # Device = "Exabyte 8mm" # MediaType = "8mm" #} # Generic catalog service Catalog { Name = MyCatalog dbname = bacula; user = bacula; password = "" } # Reasonable message delivery -- send most everything to email address # and to the console Messages { Name = Standard # # NOTE! If you send to two email or more email addresses, you will need # to replace the %r in the from field (-f part) with a single valid # email address in both the mailcommand and the operatorcommand. # mailcommand = "/opt/bacula-1.36.3/bin/bsmtp -h mail.pad.zuken.de -f \"\(Bacula\) %r\" -s \"Bacula: %t %e of %c %l\" %r" operatorcommand = "/opt/bacula-1.36.3/bin/bsmtp -h mail.pad.zuken.de -f \"\(Bacula\) %r\" -s \"Bacula: Intervention needed for %j\" %r" mail = [EMAIL PROTECTED] = all, !skipped operator = [EMAIL PROTECTED] = mount console = all, !skipped, !saved # # WARNING! the following will create a file that you must cycle from # time to time as it will grow indefinitely. However, it will # also keep all your messages if they scroll off the console. # append = "/opt/bacula-1.36.3/var/log" = all, !skipped } # # Message delivery for daemon messages (no job). Messages { Name = Daemon mailcommand = "/opt/bacula-1.36.3/bin/bsmtp -h mail.pad.zuken.de -f \"\(Bacula\) %r\" -s \"Bacula daemon message\" %r" mail = [EMAIL PROTECTED] = all, !skipped console = all, !skipped, !saved append = "/opt/bacula-1.36.3/var/log" = all, !skipped } # Default pool definition Pool { Name = Default Pool Type = Backup Recycle = yes # Bacula can automatically recycle Volumes AutoPrune = yes # Prune expired volumes Volume Retention = 4 months } Pool { Name = Month Pool Type = Backup Recycle = yes AutoPrune = yes Volume Retention = 3 years } # # Restricted console used by tray-monitor to get the status of the director # Console { Name = achernar-mon Password = "XXX" CommandACL = status, .status }
# # Default Bacula File Daemon Configuration file # # For Bacula release 1.36.3 (22 April 2005) -- solaris 5.6 # # There is not much to change here except perhaps the # File daemon Name to # # # List Directors who are permitted to contact this File daemon # Director { Name = achernar-dir Password = "XXX" } # # Restricted Director, used by tray-monitor to get the # status of the file daemon # Director { Name = achernar-mon Password = "XXX" Monitor = yes } # # "Global" File daemon configuration specifications # FileDaemon { # this is me Name = achernar-fd FDport = 9102 # where we listen for the director WorkingDirectory = /opt/bacula-1.36.3/var Pid Directory = /opt/bacula-1.36.3/var Maximum Concurrent Jobs = 20 } # Send all messages except skipped files back to Director Messages { Name = Standard director = achernar-dir = all, !skipped }
# # Default Bacula Storage Daemon Configuration file # # For Bacula release 1.36.3 (22 April 2005) -- solaris 5.6 # # 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. # Storage { # definition of myself Name = achernar-sd SDPort = 9103 # Director's port WorkingDirectory = "/opt/bacula-1.36.3/var" Pid Directory = "/opt/bacula-1.36.3/var" Maximum Concurrent Jobs = 20 } # # List Directors who are permitted to contact Storage daemon # Director { Name = achernar-dir Password = "XXX" } # # Restricted Director, used by tray-monitor to get the # status of the storage daemon # Director { Name = achernar-mon Password = "XXX" 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 = 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; } # # A Linux or Solaris tape drive # Device { Name = DDS-4 # Media Type = DDS-4 Archive Device = /dev/rmt/0cbn AutomaticMount = yes; # when device opened, read it AlwaysOpen = yes; RemovableMedia = yes; RandomAccess = no; Changer Command = "/opt/bacula-1.36.3/etc/mtx-changer %c %o %S %a %d" Changer Device = /dev/rmt/0cbn AutoChanger = yes Alert Command = "sh -c 'tapeinfo -f %c |grep TapeAlert|cat'" } # # 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 #} # # A OnStream tape drive. # You need the kernel osst driver 0.9.14 or later, and # do "mt -f /dev/nosst0 defblksize 32768" once as root. # #Device { # Name = OnStream # Description = "OnStream drive on Linux" # Media Type = OnStream # Archive Device = /dev/rmt/0cbn # AutomaticMount = yes; # when device opened, read it # AlwaysOpen = yes # Offline On Unmount = no ## The min/max blocksizes of 32768 are *required* # Minimum Block Size = 32768 # Maximum Block Size = 32768 #} # # A very old Exabyte with no end of media detection # #Device { # Name = "Exabyte 8mm" # Media Type = "8mm" # Archive Device = /dev/rmt/0cbn # Hardware end of medium = No; # AutomaticMount = yes; # when device opened, read it # AlwaysOpen = Yes; # RemovableMedia = yes; # RandomAccess = no; #} # # Send all messages to the Director, # mount messages also are sent to the email address # Messages { Name = Standard director = achernar-dir = all }