Re: [Vchanger-users] Bacula - VChanger
Brought to you by:
jaybus2
|
From: Josh F. <jf...@ja...> - 2015-09-23 12:27:59
|
On 9/22/2015 10:56 AM, Preston Lord wrote: > Hi Josh, > > Same result. After doing what you suggested, bconsole still reports: > > 22-Sep 08:41 srv03.intricatenetworks.com-d JobId 410: BeforeJob: > -rw-r--r-- 1 bacula bacula 0 Sep 22 08:32 monday_0 > 22-Sep 08:41 srv03.intricatenetworks.com-d JobId 410: Start Backup > JobId 410, Job=Server_BU_RDX.2015-09-22_08.41.14_33 > 22-Sep 08:41 srv03.intricatenetworks.com-d JobId 410: Using Device > "usb-vchanger-drive-0-backups" > 22-Sep 08:41 srv03.intricatenetworks.com-s JobId 410: Warning: Volume > "monday_0" not on device "usb-vchanger-drive-0-backups" > (/var/spool/vchanger/0). > 22-Sep 08:41 srv03.intricatenetworks.com-s JobId 410: Marking Volume > "monday_0" in Error in Catalog. > 22-Sep 08:41 srv03.intricatenetworks.com-s JobId 410: Job > Server_BU_RDX.2015-09-22_08.41.14_33 is waiting. Cannot find any > appendable volumes. > Please use the "label" command to create a new Volume for: > Storage: "usb-vchanger-drive-0-backups" (/var/spool/vchanger/0) > Pool: Scratch > Media type: File > > > > Simply running delete and then label in bconsole fixes the issue. I > suppose I can just do that for each cassette manually and then all > should be good. Just weird? It is weird. The label barcodes command in bconsole works as follows: 1. Issues LIST command to mtx-changer (or vchanger) to get list of barcodes of volumes in each slot. For vchanger, this is the filenames of the volume files 2. Issues a LOAD command to load the next slot's volume into the selected drive 3. Attempts to read volume label of the volume in the selected drive 4. If no label found, then performs a LABEL comand to write the volume label to the volume and update catalog database accordingly 5. Repeat 2 through 4 for each barcode listed in step 1. I have never had the label barcodes command fail except when there was a permissions problem, usually when I forgot to give the bacula user write permissions on the root of the backup drive. So, yes, it is strange that label barcodes fails. Do you have selinux or app armour enabled? > > Any ideas? > Yes. You say that you have to delete the volume in bconsole then run a label command. How did the volume get labeled in the first place? By label barcodes? If so, then before you run your script to delete and recreate, look at the volume file. If the volume exists in the bacula catalog, then it should have had a volume label written to it and the volume file should be around 200 bytes long. If the volume is being added to the catalog, but the volume label is not actually being written to the volume file, then that would explain why bacula cannot find the volume later when the backup runs. If that is the case, (the label barcodes command is creating the database entry for the volume, but it is not actually writing the label to the file), there are a couple of possibilities. A permissions issue (selinux?) that prevents bacula from writing the label to the file. I don't think so, since bacula would get an i/o error when writing I think. A cache issue. The RDX drive has write caching and it is not writing the label to the file until autofs unmounts the RDX cartridge or for some reason the cache is getting incoherent. > Thanks for all of your time on this!! > > Preston > > > > > > ------------------------------------------------------------------------ > *From:* Josh Fisher [jf...@ja...] > *Sent:* Tuesday, September 22, 2015 7:03 AM > *To:* Preston Lord > *Cc:* vch...@li... > *Subject:* Re: [Vchanger-users] Bacula - VChanger > > It depends upon how you want to name the volumes, but there should be > no need for scripting the labeling. > > Bacula has a method of automatically labeling volumes based on barcode > labeling. The 'label barcodes' command in bconsole will send a LIST > command to the autochanger. Tape autochangers will respond by reading > the barcodes of the tapes in its slots and listing them, whereas > vchanger emulates this by listing the volume filenames. Then it asks > if the volumes found should be labeled. It is OK to say yes, as Bacula > will not label the volumes that already have a label, only those that > do not. > > By default, the bconsole keyword in vchanger.conf has the value > 'bconsole'. This means that when vchanger creates files during the > CREATEVOLS command it will automatically invoke bconsole and issue the > 'label barcodes' command. It will use just 'bconsole' as the program > to be invoked, meaning that Bacula's bconsole program must be in a > directory in the PATH environment variable for user 'bacula'. > > I have been using CREATEVOLS without issue with the default of > bconsole = 'bconsole'. However, I think you may have discovered some > bug with the vchanger-bacula interaction, and so have the bconsole > keyword in vchanger.conf set to empty. That will prevent vchanger from > ever invoking bconsole, whether for issuing an update slots or a label > barcodes. > > With the bconsole keyword set to empty in vchanger.conf, the > CREATEVOLS command will create empty files that are not labeled from > within bconsole. The simplest way to label the empty files is with the > label barcodes command in bconsole. > > You do not have to use the CREATEVOLS command to create volume files. > You can just create empty files with the touch command and name them > anything you want. Then label them using the label barcodes command > from within bconsole. If you create empty files on a RDX cartridge and > then run a vchanger /etc/vchanger/vchanger.conf LIST command, you > should see the filenames being listed. For example: > > # touch /mnt/vchanger/friday0/file-1 > # touch /mnt/vchanger/friday0/file-2 > # ls -1 /mnt/vchanger/friday0 > file-1 > file-2 > # vcer /etc/vchanger/vchanger.conf list > 1:file-1 > 2:file-2 > 3: > 4: > 5: > 6: > 7: > 8: > 9: > > It lists each slot number and the barcode of the volume in that slot > (or empty if the slot has no volume). Ilist command does not show all > of the filenames, then there is likely a permissions issue. The label > barcodes command in bconsole should show the same list of barcodes > (ie. filenames). > > > On 9/21/2015 10:12 PM, Preston Lord wrote: >> Okay, I have confirmed that manually deleting the volume and then >> manually labeling it solves all the issues. I have tried to automate >> this in a shell script that formats the cassette etc, however I >> notice that bacula randomizes the order of the Pools when labeling >> (WTH). Do you know of a way to automate the labeling of a cassette >> other than: >> >> echo -e "label\n3\n$1_0\n1\n2\n" | bconsole >> (doesn’t wok all the time as the last part “2” is sometimes 1 as >> bacula randomizes: >> >> Enter slot (0 or Enter for none): 1 >> Defined Pools: >> 1: Default >> 2: Scratch >> >> Enter slot (0 or Enter for none): 1 >> Defined Pools: >> 1: Scratch >> 2: Default >> Not sure who thought that was a good idea. >> >> Anyway, I also tried: >> >> echo -e "label storage=vchanger volume=monday_0 slot=1 >> pool=Scratch\n" | bconsole >> >> which seems to have the same issue. It labels the cassette, or says >> it does, but it errors when I try to run the backup. >> >> Simply do the following manually: >> >> #bconsole >> delete >> volume >> Scratch >> monday_0 >> >> label >> vchanger >> monday_0 >> 1 (slot) >> Scratch >> >> run >> Job >> 1 >> Voila — all works >> >> Wierd? >> >> >> >> -- >> PRESTON J. LORD >> President >> pl...@in... >> >> iNTRICATE NETWORKS INC. >> #6 1081 Central Avenue North >> Swift Current, SK S9H 4Z2 >> T:306.778.0800 >> 1.866.949.INET >> F:306.778.0398 >> http://www.inetx.ca >> http://www.splitPanel.com <http://www.splitPanel.com/> >> >> >> >> This message and any attachments are intended only for the use of the >> addressee and may contain information that is privileged and >> confidential. If the reader of the message is not the intended >> recipient or an authorized representative of the intended recipient, >> you are hereby notified that any dissemination of this communication >> is strictly prohibited. If you have received this communication in >> error, notify the sender immediately by return email and delete the >> message and any attachments from your system. >> ------------------------------------------------------------------------ >> >> >> From: Josh Fisher <jf...@ja...> >> Date: Friday, September 18, 2015 at 12:25 PM >> To: Preston <pl...@in...>, "vch...@li... >> <mailto:vch...@li...>" >> <vch...@li... >> <mailto:vch...@li...>> >> Subject: Re: [Vchanger-users] Bacula - VChanger >> >> >> >> On 9/18/2015 12:58 PM, Preston Lord wrote: >>> Sorry for mail-bombing you …. >> >> No worries. >> >>> >>> I just did the following: >>> >>> /etc/init.d/autofs stop >>> #edited auto fs configs to ignore /mnt/vchanger >>> >>> #added friday3’s cassette manually to /etc/fstab >>> >>> mount /mnt/vchanger/friday3 >>> >>> #restarted entire server >>> >>> changed permissions to 777 on /mnt/vchanger/* -r (just to test) >>> >>> #verified the sym link is there: >>> lrwxrwxrwx 1 bacula bacula 31 Sep 18 10:33 0 -> >>> /mnt/vchanger/friday3/friday3_0 >>> >>> Run a backup and same issue. I have even deleted the vol from >>> bacula and recreated it. The persistent error remains: >> >> Hmm. When you deleted the volume, you must have then used the >> label command in bconsole to label the volume, right? Interesting >> that it it was able to find the volume and write the label to it >> just fine, then fails to recognize it when the backup job runs. >> >> I wonder if something is going wrong when vchanger tries to >> invoke bconsole to automatically perform the update slots >> command. This could be a race condition bug in vchanger. Try the >> above (manual mounting method) after putting the following line >> in vchanger.conf. >> >> bconsole = >> >> The default is for vchanger, when it detects a change in the >> volumes available, to invoke bconsole in another process and >> issue the update slots command. Setting the 'bconsole' directive >> in vchanger.conf to blank will prevent vchanger from attempting >> to issue the update slots command and eliminate that possibility, >> in addition to eliminating autofs as the issue. >> >>> >>> Recycled current volume "friday3_0" >>> Using Device "usb-vchanger-drive-0-backups" >>> Warning: Volume "friday3_0" not on device >>> "usb-vchanger-drive-0-backups" (/var/spool/vchanger/0). >>> Marking Volume "friday3_0" in Error in Catalog. >>> Job Server_BU_RDX.2015-09-18_10.54.57_06 is waiting. Cannot find >>> any appendable volumes. >>> >>> However I can su to bacula and “vi /var/spool/vchanger/0” and >>> add text, save, etc. >> >> If the symlink is being created, then vchanger succeeded with the >> LOAD command. >> >> A race condition when vchanger issues an update slots command to >> bconsole is my best guess. You are invoking vchanger in a >> BeforeScript, which will in turn call back into bconsole while >> the before script is still running. I have never tried that, so >> cannot say. But it is definitely has the potential for a race >> condition. Try disabling vchanger's automatic 'update slots' >> invocation by adding the 'bconsole=' line to vchanger.conf. >> >>> >>> Any ideas of what else I can try. Weird that it just won’t work. >>> The am using the following to format these: >>> >>> mke2fs -j -T largefile -L “friday3" -m 0 /dev/sdb1 >> >> The filesystem used doesn't affect either bacula or vchanger, as >> long as it is mounted read/write and the bacula-sd / vchanger >> user:group has write permissions on the magazine's root directory >> and all files within. >> >>> >>> Thanks again for your time. >>> >>> P. >> > |