]> git.sur5r.net Git - bacula/docs/blobdiff - docs/manual/autochangers.tex
Update
[bacula/docs] / docs / manual / autochangers.tex
index be4d137ad1b298c65e321cff93e88cb592963d61..b37484ae83b5bb553ec797f9eff4f1868bf8e272 100644 (file)
@@ -13,20 +13,26 @@ which is explained in more detail after this list:
 \begin{itemize}
 \item A script that actually controls the autochanger according  to commands
    sent by Bacula. We furnish such a script  that works with {\bf mtx} found in
-   the {\bf depkgs} distribution.  This script works only with single drive
-   autochangers.  
+   the {\bf depkgs} distribution. 
+
 \item That each Volume (tape) to be used must be defined in the  Catalog and
    have a Slot number assigned  to it so that Bacula knows where the Volume is in
-   the  autochanger. This is generally done with the {\bf label}  command. See
+   the  autochanger. This is generally done with the {\bf label}  command,
+   but can also done after the tape is labeled using the {\bf update slots}
+   command.  See
    below for more details. You must pre-label the tapes manually before
-   using them. 
+   using them.         
+
 \item Modifications to your Storage daemon's Device configuration  resource to
    identify that the device is a changer, as well  as a few other parameters.  
+
 \item You should also modify your Storage resource definition  in the
    Director's configuration file so that you are automatically prompted for the
    Slot when labeling a Volume. 
+
 \item You need to ensure that your Storage daemon (if not running as root)
    has access permissions to both the tape drive and the control device.
+
 \item You need to have {\bf Autochanger = yes} in your Storage resource
    in your bacula-dir.conf file so that you will be prompted for the
    slot number when you label Volumes.
@@ -35,11 +41,12 @@ which is explained in more detail after this list:
 In version 1.37 and later, there is a new \ilink{Autochanger
 resource}{AutochangerRes} that permits you to group Device resources thus
 creating a multi-drive autochanger. If you have an autochanger,
-you must use this new resource. 
+you {\bf must} use this new resource. 
 
 Bacula uses its own {\bf mtx-changer} script to interface with a program
 that actually does the tape changing.  Thus in principle, {\bf mtx-changer}
-can be adapted to function with any autochanger program.  The current
+can be adapted to function with any autochanger program, or you can
+call any other script or program. The current
 version of {\bf mtx-changer} works with the {\bf mtx} program.  However,
 FreeBSD users have provided a script in the {\bf examples/autochangers}
 directory that allows Bacula to use the {\bf chio} program.
@@ -50,8 +57,13 @@ and {\bf update slots}. For more details on these commands, see the "Barcode
 Support" section below. 
 
 Current Bacula autochanger support does not include cleaning, stackers, or
-silos.  However, under certain conditions, you may be able to make Bacula
-work with stackers (gravity feed and such).  Support for multi-drive
+silos. Stackers and silos are not supported because Bacula expects to
+be able to access the Slots randomly.
+However, if you are very careful to setup Bacula to access the Volumes
+in the autochanger sequentially, you may be able to make Bacula
+work with stackers (gravity feed and such).  
+
+Support for multi-drive
 autochangers requires the \ilink{Autochanger resource}{AutochangerRes}
 introduced in version 1.37.  This resource is also recommended for single
 drive autochangers.
@@ -60,10 +72,19 @@ In principle, if {\bf mtx} will operate your changer correctly, then it is
 just a question of adapting the {\bf mtx-changer} script (or selecting one
 already adapted) for proper interfacing. You can find a list of autochangers
 supported by {\bf mtx} at the following link: 
-\elink{http://mtx.badtux.net/compatibility.php}
-{http://mtx.badtux.net/compatibility.php}.
+\elink{http://mtx.opensource-sw.net/compatibility.php}
+{http://mtx.opensource-sw.net/compatibility.php}.
 The home page for the {\bf mtx} project can be found at: 
-\elink{http://mtx.badtux.net/}{http://mtx.badtux.net/}. 
+\elink{http://mtx.opensource-sw.net/}{http://mtx.opensource-sw.net/}. 
+
+Note, we have feedback from some users that there are certain
+incompatibilities between the Linux kernel and mtx.  For example between
+kernel 2.6.18-8.1.8.el5 of CentOS and RedHat and version 1.3.10 and 1.3.11
+of mtx.  This was fixed by upgrading to a version 2.6.22 kernel.
+
+In addition, apparently certain versions of mtx, for example, version
+1.3.11 limit the number of slots to a maximum of 64. The solution was to
+use version 1.3.10.
 
 If you are having troubles, please use the {\bf auto} command in the {\bf
 btape} program to test the functioning of your autochanger with Bacula. When
@@ -72,6 +93,14 @@ Debian, ...) the Storage daemon runs as {\bf bacula.tape} rather than {\bf
 root.root}, so you will need to ensure that the Storage daemon has sufficient
 permissions to access the autochanger. 
 
+Some users have reported that the the Storage daemon blocks under certain
+circumstances in trying to mount a volume on a drive that has a different
+volume loaded.  As best we can determine, this is simply a matter of
+waiting a bit.  The drive was previously in use writing a Volume, and
+sometimes the drive will remain BLOCKED for a good deal of time (up to 7
+minutes on a slow drive) waiting for the cassette to rewind and to unload
+before the drive can be used with a different Volume.
+
 \label{SCSI devices}
 \section{Knowing What SCSI Devices You Have}
 \index[general]{Have!Knowing What SCSI Devices You }
@@ -99,6 +128,10 @@ to find out how to specify their control address ({\bf /dev/sg0} for the
 first, {\bf /dev/sg1} for the second, ...) on the {\bf Changer Device = }
 Bacula directive. 
 
+For more detailed information on what SCSI devices you have please see
+the \ilink{Linux SCSI Tricks}{SCSITricks}  section of the Tape Testing
+chapter of this manual.
+
 Under FreeBSD, you can use: 
 
 \footnotesize
@@ -114,10 +147,10 @@ Please check that your Storage daemon has permission to access this
 device.
 
 The following tip for FreeBSD users comes from Danny Butroyd:
-n reboot bacula will NOT have permissions to 
+on reboot Bacula will NOT have permission to 
 control the device /dev/pass0 (assuming this is your changer device).  
 To get around this just edit the /etc/devfs.conf file and add the 
-following to the bottom of the config file:
+following to the bottom:                   
 \footnotesize
 \begin{verbatim}
 own     pass0   root:bacula
@@ -126,17 +159,17 @@ own     nsa0.0  root:bacula
 perm    nsa0.0    0666
 \end{verbatim}
 \normalsize
-I have given the bacula group permission to write to the nsa0.0 device 
+
+This gives the bacula group permission to write to the nsa0.0 device 
 too just to be on the safe side.   To bring these changes into effect 
 just run:-
 
 /etc/rc.d/devfs restart
 
-Basically this will stop you having to change permissions on these 
-devices to make bacula work when operating the AutoChanger after a reboot.
+Basically this will stop you having to manually change permissions on these 
+devices to make Bacula work when operating the AutoChanger after a reboot.
 
 \label{scripts}
-
 \section{Example Scripts}
 \index[general]{Scripts!Example }
 \index[general]{Example Scripts }
@@ -162,14 +195,19 @@ number of cartridges contained in the autochanger.
 
 Bacula will not automatically use a Volume in your autochanger unless it is
 labeled and the slot number is stored in the catalog and the Volume is marked
-as InChanger. For each Volume in your
+as InChanger. This is because it must know where each volume is (slot) to
+be able to load the volume.
+For each Volume in your
 changer, you will, using the Console program, assign a slot. This information
 is kept in {\bf Bacula's} catalog database along with the other data for the
 volume. If no slot is given, or the slot is set to zero, Bacula will not
 attempt to use the autochanger even if all the necessary configuration records
-are present. In addition, the console {\bf mount} command does not cause
-Bacula to operate the autochanger, it only tells Bacula to read any tape that
-may be in the drive. 
+are present. When doing a {\bf mount} command on an autochanger, you must
+specify which slot you want mounted.  If the drive is loaded with a tape 
+from another slot, it will unload it and load the correct tape, but
+normally, no tape will be loaded because an {\bf unmount} command causes
+Bacula to unload the tape in the drive.
+          
 
 You can check if the Slot number and InChanger flag are set by doing a:
 \begin{verbatim}
@@ -180,12 +218,11 @@ in the Console program.
 
 \label{mult}
 \section{Multiple Devices}
-\index[general]{Devices!Multiple }
-\index[general]{Multiple Devices }
+\index[general]{Devices!Multiple}
+\index[general]{Multiple Devices}
 
 Some autochangers have more than one read/write device (drive). The
-new 
-\ilink{Autochanger resource}{AutochangerRes} introduced in version
+new \ilink{Autochanger resource}{AutochangerRes} introduced in version
 1.37 permits you to group Device resources, where each device 
 represents a drive. The Director may still reference the Devices (drives)
 directly, but doing so, bypasses the proper functioning of the
@@ -204,6 +241,14 @@ that device. In general, the second device will have the same {\bf Changer
 Device} (control channel) as the first drive, but a different {\bf Archive
 Device}. 
 
+As a default, Bacula jobs will prefer to write to a Volume that is
+already mounted. If you have a multiple drive autochanger and you want
+Bacula to write to more than one Volume in the same Pool at the same
+time, you will need to set \ilink{Prefer Mounted Volumes} {PreferMountedVolumes}
+in the Directors Job resource to {\bf no}. This will cause
+the Storage daemon to maximize the use of drives.
+
+
 \label{ConfigRecords}
 \section{Device Configuration Records}
 \index[general]{Records!Device Configuration }
@@ -670,28 +715,35 @@ you must resolve the  problem (e.g. try a different SCSI control device name
 if {\bf /dev/sg0}  is incorrect. For example, on FreeBSD systems, the
 autochanger  SCSI control device is generally {\bf /dev/pass2}.  
 
-\item [/etc/bacula/mtx-changer \ /dev/sg0 \ slots \ 0 \ /dev/nst0 \ 0]
+\item [/etc/bacula/mtx-changer \ /dev/sg0 \ slots ]
 \index[sd]{mtx-changer slots}
 
 This command should return the number of slots in your autochanger.  
 
-\item [/etc/bacula/mtx-changer \ /dev/sg0 \ unload \ ]
+\item [/etc/bacula/mtx-changer \ /dev/sg0 \ unload \ 1 \ /dev/nst0 \ 0 ]
 \index[sd]{mtx-changer unload}
 
-   If a tape is loaded, this should cause  it to be unloaded.  
+   If a tape is loaded from slot 1, this should cause it to be unloaded.  
 
 \item [/etc/bacula/mtx-changer \ /dev/sg0 \ load \ 3 \ /dev/nst0 \ 0 ]
 \index[sd]{mtx-changer load}
 
-Assuming you have a tape in slot 3,  it will be loaded into the read slot (0).
+Assuming you have a tape in slot 3,  it will be loaded into drive (0).
  
 
 \item [/etc/bacula/mtx-changer \ /dev/sg0 \ loaded \ 0 \ /dev/nst0 \ 0]
 \index[sd]{mtx-changer loaded}
 
 It should print "3"  
+Note, we have used an "illegal" slot number 0. In this case, it is simply
+ignored because the slot number is not used.  However, it must be specified
+because the drive parameter at the end of the command is needed to select
+the correct drive.
+
+\item [/etc/bacula/mtx-changer \ /dev/sg0 \ unload \ 3 /dev/nst0 \ 0]
+
+will unload the tape into slot 3.
 
-\item [/etc/bacula/mtx-changer \ /dev/sg0 \ unload]
 \end{description}
 
 Once all the above commands work correctly, assuming that you have the right
@@ -711,8 +763,8 @@ commands into a file and running it as a script:
 \footnotesize
 \begin{verbatim}
 #!/bin/sh
-/etc/bacula/mtx-changer /dev/sg0 unload
-/etc/bacula/mtx-changer /dev/sg0 load 3
+/etc/bacula/mtx-changer /dev/sg0 unload 1 /dev/nst0 0
+/etc/bacula/mtx-changer /dev/sg0 load 3 /dev/nst0 0
 mt -f /dev/st0 rewind
 mt -f /dev/st0 weof
 \end{verbatim}
@@ -733,9 +785,9 @@ unload so that the script looks like:
 \footnotesize
 \begin{verbatim}
 #!/bin/sh
-/etc/bacula/mtx-changer /dev/sg0 unload
+/etc/bacula/mtx-changer /dev/sg0 unload 1 /dev/nst0 0
 mt -f /dev/st0 offline
-/etc/bacula/mtx-changer /dev/sg0 load 3
+/etc/bacula/mtx-changer /dev/sg0 load 3 /dev/nst0 0
 mt -f /dev/st0 rewind
 mt -f /dev/st0 weof
 \end{verbatim}
@@ -897,8 +949,9 @@ prevent Bacula from attempting to write on the Volume.
 
 Bacula calls the autochanger script that you specify on the {\bf Changer
 Device} statement. Normally this script will be the {\bf mtx-changer} script
-that we can provide, but it can in fact be any program. The only requirements
-are that the "commands" that Bacula uses are {\bf loaded}, {\bf load}, {\bf
+that we provide, but it can in fact be any program. The only requirement
+for the script is that it must understand the commands that
+Bacula uses, which are {\bf loaded}, {\bf load}, {\bf
 unload}, {\bf list}, and {\bf slots}. In addition,
 each of those commands must return the information in the precise format as
 specified below: 
@@ -924,5 +977,5 @@ specified below:
 \normalsize
 
 Bacula checks the exit status of the program called, and if it is zero, the
-data is accepted. If the exit status is non-zero, Bacula ignores any
-information returned and treats the drive as if it is not an autochanger. 
+data is accepted. If the exit status is non-zero, Bacula will print an
+error message and request the tape be manually mounted on the drive.