Bacula-users

Re: [Bacula-users] Bacula and vchanger Cannot Label Volume

2016-05-11 02:47:00
Subject: Re: [Bacula-users] Bacula and vchanger Cannot Label Volume
From: Pann Tolk <pann.tolk AT gmail DOT com>
To: bacula-users AT lists.sourceforge DOT net, Josh Fisher <jfisher AT pvct DOT com>
Date: Wed, 11 May 2016 14:45:23 +0800
Ok, responding to my own post.  I believe I might have resolved the problem.

I  was looking at the working directory of vchanger and then I noticed that there were TWO entries: "drive0" and an entry "0" which is a link to the volume that was last loaded into the "drive" of the autochanger:

[root@deneb ~]# ls -l /var/spool/vchanger/vchanger01/
total 20
lrwxrwxrwx 1 bacula tape  65 May 11 13:25 0 -> /mnt/vchanger/1fde15be-83a4-4b67-accc-378d5fa10ea7/vchanger01_0_9
-rw-r----- 1 bacula tape  47 May 11 13:25 bay_state-0
-rw-r----- 1 bacula tape 201 May 10 17:36 drive0
-rw-r----- 1 bacula tape  57 May 11 13:25 drive_state-0
-rw-r----- 1 bacula tape  17 May 11 13:25 dynamic.conf


I went "hmmm....my "Archive Device" in bacula-sd.conf is "/var/spool/vchanger/vchanger01/drive0", why is it not the entry "drive0" pointing to the last mounted volume file?  But it's the entry "0" that's pointing to the last mounted volume file?....something wrong with my bacula-sd.conf?"

So, I did a test to confirm that the entry "0" is dynamically created during mounting.  From bconsole, I executed "unmount slot=18 drive=0".  Checked the directory /var/spool/vchanger/vchanger01/ again:

[root@deneb ~]# ls -l /var/spool/vchanger/vchanger01/
total 12
-rw-r----- 1 bacula tape  47 May 11 14:10 bay_state-0
-rw-r----- 1 bacula tape 201 May 10 17:36 drive0
-rw-r----- 1 bacula tape  17 May 11 14:10 dynamic.conf


This time, the entries "0" and "drive_state-0" is gone.

So, I think, maybe it's got to do with the configuration in bacula-sd:  Archive Device = "/var/spool/vchanger/vchanger01/drive0"

I then edited bacula-sd.conf and changed

Archive Device = "/var/spool/vchanger/vchanger01/drive0"
to
Archive Device = "/var/spool/vchanger/vchanger01/0"

I also edited vchanger.conf and changed
bconsole=""
back to
bconsole="/usr/sbin/bconsole"

Restarted bacula-sd, deleted all the volume files in the disk, executed "delete" in bconsole to remove all the volumes previously added from the catalog.

Next, I recreated the volumes:

[root@deneb ~]# vchanger  /etc/vchanger/vchanger01.conf createvols 0 18

This time, everything went off smoothly.

From bconsole:
*status slots storage=vchanger01 drive=0
Connecting to Storage daemon vchanger01 at deneb.chuakt.local:9103 ...
3306 Issuing autochanger "slots" command.
Device "SATA-vchanger01" has 37 slots.
Connecting to Storage daemon vchanger01 at deneb.chuakt.local:9103 ...
3306 Issuing autochanger "list" command.
 Slot |   Volume Name    |   Status  |     Media Type       |      Pool          |
------+------------------+-----------+----------------------+--------------------|
    1 |   vchanger01_0_0 |    Append |                 File |            Scratch |
    2 |   vchanger01_0_1 |    Append |                 File |            Scratch |
    3 |  vchanger01_0_10 |    Append |                 File |            Scratch |
    4 |  vchanger01_0_11 |    Append |                 File |            Scratch |
    5 |  vchanger01_0_12 |    Append |                 File |            Scratch |
    6 |  vchanger01_0_13 |    Append |                 File |            Scratch |
    7 |  vchanger01_0_14 |    Append |                 File |            Scratch |
    8 |  vchanger01_0_15 |    Append |                 File |            Scratch |
    9 |  vchanger01_0_16 |    Append |                 File |            Scratch |
   10 |  vchanger01_0_17 |    Append |                 File |            Scratch |
   11 |   vchanger01_0_2 |    Append |                 File |            Scratch |
   12 |   vchanger01_0_3 |    Append |                 File |            Scratch |
   13 |   vchanger01_0_4 |    Append |                 File |            Scratch |
   14 |   vchanger01_0_5 |    Append |                 File |            Scratch |
   15 |   vchanger01_0_6 |    Append |                 File |            Scratch |
   16 |   vchanger01_0_7 |    Append |                 File |            Scratch |
   17 |   vchanger01_0_8 |    Append |                 File |            Scratch |
   18 |   vchanger01_0_9 |    Append |                 File |            Scratch |
   19*|                  |         ? |                    ? |                  ? |
...
...
   37*|                  |         ? |                    ? |                  ? |



I'm off now to create more volumes in the other "magazines" (filesystems) and other tasks to complete this setup.

Another problem I'm facing so far is the udev script /usr/libexec/vchanger/vchanger-mount-uuid.sh not actually mounting the inserted disks...but instead it creates a mount point (eg /mnt/vchanger/1fde15be-83a4-4b67-accc-378d5fa10ea7) with root:root permission.

Thanks for your time.

Pann




On Wed, May 11, 2016 at 10:34 AM, Pann Tolk <pann.tolk AT gmail DOT com> wrote:
Hi,

Please ignore my previous message.  The interface between between the chair and the keyboard was too quick to hit the "Send" button.

On Tue, May 10, 2016 at 11:00 PM, Josh Fisher <jfisher AT pvct DOT com> wrote:

Hi Pann,

This is almost certainly the vchanger race condition bug that I mentioned previously. The bconsole output in the vchanger log tells me that bconsole is being invoked by vchanger to label the volumes. Put a bconsole='' line in vchanger.conf and try running the label barcodes command from bconsole.

I did what you asked me to try:  I changed the line bconsole="/usr/sbin/vconsole" to bconsole="" in vchanger.conf.  Then run the label barcode command in bconsole:

[root@deneb mnt]# bconsole
Connecting to Director deneb.pt.local:9101
1000 OK: 102 bacula-dir Version: 7.4.0 (16 January 2016)
Enter a period to cancel a command.
*label storage="vchanger01" pool="Scratch" barcodes
Automatically selected Catalog: MyCatalog
Using Catalog "MyCatalog"
Connecting to Storage daemon vchanger01 at deneb.pt.local:9103 ...
Connecting to Storage daemon vchanger01 at deneb.pt.local:9103 ...
3306 Issuing autochanger "slots" command.
Device "SATA-vchanger01" has 37 slots.
Connecting to Storage daemon vchanger01 at deneb.pt.local:9103 ...
3306 Issuing autochanger "list" command.
The following Volumes will be labeled:
Slot  Volume
==============
   1  vchanger01_0_0
   2  vchanger01_0_1
   3  vchanger01_0_10
   4  vchanger01_0_11
   5  vchanger01_0_12
   6  vchanger01_0_13
   7  vchanger01_0_14
   8  vchanger01_0_15
   9  vchanger01_0_16
  10  vchanger01_0_17
  11  vchanger01_0_2
  12  vchanger01_0_3
  13  vchanger01_0_4
  14  vchanger01_0_5
  15  vchanger01_0_6
  16  vchanger01_0_7
  17  vchanger01_0_8
  18  vchanger01_0_9
Do you want to label these Volumes? (yes|no): yes
Media record for Slot 1 Volume "vchanger01_0_0" already exists.
Connecting to Storage daemon vchanger01 at deneb.pt.local:9103 ...
Sending label command for Volume "vchanger01_0_1" Slot 2 ...
3307 Issuing autochanger "unload slot 18, drive 0" command for vol vchanger01_0_1.
3304 Issuing autochanger "load slot 2, drive 0" command for vol vchanger01_0_1.
3305 Autochanger "load slot 2, drive 0", status is OK for vol vchanger01_0_1.
3920 Cannot label Volume because it is already labeled: "vchanger01_0_0"
Label command failed for Volume vchanger01_0_1.
Sending label command for Volume "vchanger01_0_10" Slot 3 ...
3307 Issuing autochanger "unload slot 2, drive 0" command for vol vchanger01_0_10.
3304 Issuing autochanger "load slot 3, drive 0" command for vol vchanger01_0_10.
3305 Autochanger "load slot 3, drive 0", status is OK for vol vchanger01_0_10.
3920 Cannot label Volume because it is already labeled: "vchanger01_0_0"
Label command failed for Volume vchanger01_0_10.
Sending label command for Volume "vchanger01_0_11" Slot 4 ...
3307 Issuing autochanger "unload slot 3, drive 0" command for vol vchanger01_0_11.
3304 Issuing autochanger "load slot 4, drive 0" command for vol vchanger01_0_11.
3305 Autochanger "load slot 4, drive 0", status is OK for vol vchanger01_0_11.
3920 Cannot label Volume because it is already labeled: "vchanger01_0_0"
Label command failed for Volume vchanger01_0_11.
...
...



I'm still getting the error "3920 Cannot label Volume because it is already labeled: "vchanger01_0_0"" for slots 2 - 18.

Only the volume in slot 1 is added to the catalog:

*status slots storage=vchanger01 drive=0
Connecting to Storage daemon vchanger01 at deneb.pt.local:9103 ...
3306 Issuing autochanger "slots" command.
Device "SATA-vchanger01" has 37 slots.
Connecting to Storage daemon vchanger01 at deneb.pt.local:9103 ...
3306 Issuing autochanger "list" command.
 Slot |   Volume Name    |   Status  |     Media Type       |      Pool          |
------+------------------+-----------+----------------------+--------------------|
    1 |   vchanger01_0_0 |    Append |                 File |            Scratch |
    2*|   vchanger01_0_1 |         ? |                    ? |                  ? |
    3*|  vchanger01_0_10 |         ? |                    ? |                  ? |
    4*|  vchanger01_0_11 |         ? |                    ? |                  ? |
...
...
   37*|                  |         ? |                    ? |                  ? |
*

This is the libudev used on Centos 7.2:

[root@deneb mnt]# ldd /usr/bin/vchanger | grep libudev
        libudev.so.1 => /lib64/libudev.so.1 (0x00007f6c57df5000)
[root@deneb mnt]# ls -l /lib64/libudev.so.1
lrwxrwxrwx. 1 root root 16 May  8 19:45 /lib64/libudev.so.1 -> libudev.so.1.6.2

[root@deneb mnt]# cat /etc/redhat-release
CentOS Linux release 7.2.1511 (Core)
[root@deneb mnt]# uname -r
3.10.0-327.13.1.el7.x86_64

Any thing else I can do to resolve this issue?

Thanks again

Pann





------------------------------------------------------------------------------
Mobile security can be enabling, not merely restricting. Employees who
bring their own devices (BYOD) to work are irked by the imposition of MDM
restrictions. Mobile Device Manager Plus allows you to control only the
apps on BYO-devices by containerizing them, leaving personal data untouched!
https://ad.doubleclick.net/ddm/clk/304595813;131938128;j
_______________________________________________
Bacula-users mailing list
Bacula-users AT lists.sourceforge DOT net
https://lists.sourceforge.net/lists/listinfo/bacula-users