![]()
GeneralBeginning with version 1.23, Bacula provides autochanger support for writing tapes. In order to work with an autochanger, Bacula requires the services of an external program that actually commands the physical device. Bacula uses its own mtx-changer script to interface with a standalone program that actually does the tape changing. In principle, mtx-changer can be adapted to function with any autochanger program. The current version of mtx-changer works with the mtx program.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). SlotsSome autochangers have more than one read/write device (drive). The current implementation, assumes the autochanger has only one device. To properly address autochangers, Bacula must know which Volume is in each slot of the autochanger. Slots are where the changer cartridges reside when not loaded into the drive. Bacula numbers these slots from one to the number of cartridges contained in the autochanger.For each Volume in your changer, you will, using the Console program, assign a slot. This information is kept in Bacula's media 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. Device Configuration RecordsConfiguration of autochangers within Bacula is done in the Device resource of the Storage daemon. Four records: Auto Changer, Changer Device, Changer Command, and Maximum Changer Wait control how Bacula uses the autochanger.These four records, permitted in Device resources, are described in detail below:
An Example Configuration FileThe following Device resource implements an autochanger:Device { Name = "AutoChanger" Media Type = DDS-4 Archive Device = /dev/nst0 # Normal archive device Changer Device = /dev/sg0 # Generic SCSI device name Changer Command = "/usr/bin/bacula/mtx-changer %c %o %S" AutoChanger = yes LabelMedia = no; # lets Bacula label unlabeled media AutomaticMount = yes; # when device opened, read it AlwaysOpen = yes; Mount Anonymous Volumes = no; # Require Volumes in Catalog order }where you will adapt the Archive Device, the Changer Device, and the path to the Changer Command to correspond to the values used on your system. The above Device resource will work equally well for any standard tape drive (with device name /dev/nst0) since the extra autochanger commands will not be used unless a slot has been specified in the catalog record for the Volume to be used. See below for more details on the slot. Specifying Slots When LabelingIf you add an AutoChanger = yes record to the Pool resource in your Director's configuration file, the Bacula Console will automatically prompt you for the slot number when you add or label tapes. Thus all stages of dealing with tapes can be totally automated.Even though all the above configuration statements are specified and correct, Bacula will attempt to access the autochanger only if a slot is specified in the catalog Volume record (with the Volume name). Testing the AutoChangerBefore attempting to use the autochanger with Bacula, it is preferable to "hand-test" that the changer works. To do so, we suggest you do the following commands (assuming that the mtx-changer script is installed in /usr/bin/bacula/mtx-changer:
Using the AutochangerLets assume that you have properly defined the necessary Storage daemon Device records, and you have added the Autochanger = yes record to the Pool resource in your Director's configuration file.Now you fill your autochanger with say six blank tapes. What do you do to make Bacula access those tapes? One strategy is to prelabel each of the tapes. Do so by starting Bacula, then with the Console program, enter the label command: ./console Connecting to Director rufus:8101 1000 OK: rufus-dir Version: 1.26 (4 October 2002) *labelit will then prints something like: Using default Catalog name=BackupDB DB=bacula The defined Storage resources are: 1: AutoChanger 2: File Select Storage resource (1-2): 1I select the autochanger (1), and it prints: Enter new Volume name: TestVolume1 Enter slot (0 for none): 1where I entered TestVolume1 for the tape name, and slot 1 for the slot. It then asks: Defined Pools: 1: Default 2: File Select the Pool (1-2): 1I select the Default pool. This will be automatically done if you only have a single pool, then Bacula will proceed to unload any loaded volume, load the volume in slot 1 and label it. In this example, nothing was in the drive, so it printed: Connecting to Storage daemon AutoChanger at localhost:9103 ... Sending label command ... 3903 Issuing autochanger "load slot 1" command. 3000 OK label. Volume=TestVolume1 Device=/dev/nst0 Media record for Volume=TestVolume1 successfully created. Requesting mount AutoChanger ... 3001 Device /dev/nst0 is mounted with Volume TestVolume1 You have messages. *You may then proceed to label the other volumes. The messages will change slightly because Bacula will unload the volume (just labeled TestVolume1) before loading the next volume to be labeled. Once all your Volumes are labeled, Bacula will automatically load them as they are needed. To "see" how you have labeled your Volumes, simply enter the list volumes command from the Console program, which should print something like the following: *list volumes Using default Catalog name=BackupDB DB=bacula Defined Pools: 1: Default 2: File Select the Pool (1-2): 1 +---------+----------+-----------+-----------+----------+------------+----------+-------+------+ | MediaId | VolName | MediaType | VolStatus | VolBytes | LstWritten | VolReten | Recyc | Slot | +---------+----------+-----------+-----------+----------+------------+----------+-------+------+ | 1 | TestVol1 | DDS-4 | Append | 0 | 0 | 30672000 | 0 | 1 | | 2 | TestVol2 | DDS-4 | Append | 0 | 0 | 30672000 | 0 | 2 | | 3 | TestVol3 | DDS-4 | Append | 0 | 0 | 30672000 | 0 | 3 | | ... | +---------+----------+-----------+-----------+----------+------------+----------+-------+------+ Bacula Autochanger Interface- Currently the changer commands used are: loaded -- returns number of slot loaded or 0 load -- loads a specified slot (note, some autochangers require a 30 second pause after this command) unload -- unloads the device (returns cassette to its slot) - Other changer commands defined but not yet used: list -- returns a single line containing list of slots containing a cassette, each slot is separated from the others by a space. slots -- returns total number of slots
|