On Sat, Feb 13, 2016 at 2:54 AM, Marco van Wieringen <
[email protected]> wrote:


> You seem to have several problems, first of all the drive index are not
> right
> as when mtx loads something into your virtual drive it uses the drive index
> and then it tries using it and gets "No Medium found". I would also start
> with
> one drive and get that working. Further more don't use ANSI labels they
> are limited (to 6 chars as you see) and only needed if you ever think
> about sharing volumes with other commercial (mostly IBM) backup software.
>
> So I think your puzzle is to get the drive mappings right e.g. what drive
> index maps to what "logical tape drive" on the OS.
>
> --
> Marco van Wieringen                   [email protected]
> Bareos GmbH & Co. KG                  Phone: +49-221-63069389
> http://www.bareos.com
>
> Sitz der Gesellschaft: Köln | Amtsgericht Köln: HRA 29646
> Komplementär: Bareos Verwaltungs-GmbH
> Geschäftsführer: Stephan Dühr, M. Außendorf, J. Steffens,
>                  P. Storz, M. v. Wieringen
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "bareos-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/bareos-users/lVsSM5UlgKQ/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> To post to this group, send email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

Hi Marco,

Thanks for your quick reply!  So based on your suggestions, I did some more
configuring and testing.  I pared down bareos-sd.conf to include just the
autochanger and one tape drive (0), as follows:

Autochanger {
  Name            = I2M-AWS-TDC
  Device          = I2M-AWS-TD0
  Changer Command = "/usr/lib/bareos/scripts/mtx-changer %c %o %S %a %d"
  Changer Device  =
"/dev/tape/by-path/ip-172.30.0.99:3260-iscsi-iqn.1997-05.com.amazon:sgw-f4896c9d-mediachanger-lun-0"
}

Device {
  Name                    = I2M-AWS-TD0
  Archive Device          =
/dev/tape/by-path/ip-172.30.0.99:3260-iscsi-iqn.1997-05.com.amazon:sgw-f4896c9d-tapedrive-01-lun-0-nst
  Device Type             = Tape
  Media Type              = ULTRIUM5
  Autochanger             = yes
  Drive Index             = 0
  Maximum Concurrent Jobs = 1
}


I left out any external labels as well, as you suggested.  So now the drive
index (0) should be correct since there is only one drive configured.  I
started with tape drive 0 empty, and loaded up a fresh set of 5 blank tapes
(100 GB each) into slots 1-5:

# mtx -f
/dev/tape/by-path/ip-172.30.0.99:3260-iscsi-iqn.1997-05.com.amazon:sgw-f4896c9d-mediachanger-lun-0
status | grep 'Data Transfer Element 0'

Data Transfer Element 0:Empty

# mtx -f
/dev/tape/by-path/ip-172.30.0.99:3260-iscsi-iqn.1997-05.com.amazon:sgw-f4896c9d-mediachanger-lun-0
status | grep ':Full'

      Storage Element 1:Full :VolumeTag=IIMC362093
      Storage Element 2:Full :VolumeTag=IIMC2A208F
      Storage Element 3:Full :VolumeTag=IIMC372092
      Storage Element 4:Full :VolumeTag=IIMC342091
      Storage Element 5:Full :VolumeTag=IIMC352090

I wanted to test the autochanger with btape, but I knew that the btape
autochanger test required that there be an unloaded tape in slot 1;
however, I couldn't start btape without a tape loaded in the drive, so I
loaded the tape from slot 2:


# mtx -f
/dev/tape/by-path/ip-172.30.0.99:3260-iscsi-iqn.1997-05.com.amazon:sgw-f4896c9d-mediachanger-lun-0
load 2 0

Loading media from Storage Element 2 into drive 0...done

# mtx -f
/dev/tape/by-path/ip-172.30.0.99:3260-iscsi-iqn.1997-05.com.amazon:sgw-f4896c9d-mediachanger-lun-0
status | grep ':Full'

Data Transfer Element 0:Full (Storage Element 2 Loaded):VolumeTag =
IIMC2A208F
      Storage Element 1:Full :VolumeTag=IIMC362093
      Storage Element 3:Full :VolumeTag=IIMC372092
      Storage Element 4:Full :VolumeTag=IIMC342091
      Storage Element 5:Full :VolumeTag=IIMC352090


Next, I started btape and ran the autochanger test, to make sure that
Bareos would handle changing tapes using the configuration in
bareos-sd.conf:

# btape -c /etc/bareos/bareos-sd.conf
/dev/tape/by-path/ip-172.30.0.99:3260-iscsi-iqn.1997-05.com.amazon:sgw-f4896c9d-tapedrive-01-lun-0-nst

Tape block granularity is 1024 bytes.
btape: butil.c:274-0 Using device:
"/dev/tape/by-path/ip-172.30.0.99:3260-iscsi-iqn.1997-05.com.amazon:sgw-f4896c9d-tapedrive-01-lun-0-nst"
for writing.
btape: btape.c:487-0 open device "I2M-AWS-TD0"
(/dev/tape/by-path/ip-172.30.0.99:3260-iscsi-iqn.1997-05.com.amazon:sgw-f4896c9d-tapedrive-01-lun-0-nst):
OK
*autochanger

Ah, I see you have an autochanger configured.
To test the autochanger you must have a blank tape
 that I can write on in Slot 1.

Do you wish to continue with the Autochanger test? (y/n): y


=== Autochanger test ===

3301 Issuing autochanger "loaded" command.
Slot 2 loaded. I am going to unload it.
3302 Issuing autochanger "unload 2 0" command.
unload status=OK 0
3303 Issuing autochanger "load 1 0" command.
3303 Autochanger "load 1 0" status is OK.
btape: btape.c:487-0 open device "I2M-AWS-TD0"
(/dev/tape/by-path/ip-172.30.0.99:3260-iscsi-iqn.1997-05.com.amazon:sgw-f4896c9d-tapedrive-01-lun-0-nst):
OK
btape: btape.c:1587-0 Rewound "I2M-AWS-TD0"
(/dev/tape/by-path/ip-172.30.0.99:3260-iscsi-iqn.1997-05.com.amazon:sgw-f4896c9d-tapedrive-01-lun-0-nst)
btape: btape.c:1594-0 Wrote EOF to "I2M-AWS-TD0"
(/dev/tape/by-path/ip-172.30.0.99:3260-iscsi-iqn.1997-05.com.amazon:sgw-f4896c9d-tapedrive-01-lun-0-nst)

The test autochanger worked!!


*quit


This succeeded.  I verified that the tape-swap had taken place:

# mtx -f
/dev/tape/by-path/ip-172.30.0.99:3260-iscsi-iqn.1997-05.com.amazon:sgw-f4896c9d-mediachanger-lun-0
status | grep ':Full'

Data Transfer Element 0:Full (Storage Element 1 Loaded):VolumeTag =
IIMC362093
      Storage Element 2:Full :VolumeTag=IIMC2A208F
      Storage Element 3:Full :VolumeTag=IIMC372092
      Storage Element 4:Full :VolumeTag=IIMC342091
      Storage Element 5:Full :VolumeTag=IIMC352090


Since the slot 1 tape was loaded and blank, I ran the TAR test one more
time:

# mt -f
/dev/tape/by-path/ip-172.30.0.99:3260-iscsi-iqn.1997-05.com.amazon:sgw-f4896c9d-tapedrive-01-lun-0
rewind

# echo $?

0

# tar cvf
/dev/tape/by-path/ip-172.30.0.99:3260-iscsi-iqn.1997-05.com.amazon:sgw-f4896c9d-tapedrive-01-lun-0
.

./
./.ssh/
./.ssh/authorized_keys
./install_bareos
./.bash_history
./.bashrc

---snip---

./.local/share/mc/
./.local/share/mc/history
./.local/share/mc/filepos
./.local/share/mc/mcedit/
./.selected_editor
./.profile

# mt -f
/dev/tape/by-path/ip-172.30.0.99:3260-iscsi-iqn.1997-05.com.amazon:sgw-f4896c9d-tapedrive-01-lun-0
rewind

# echo $?

0

# tar tvf
/dev/tape/by-path/ip-172.30.0.99:3260-iscsi-iqn.1997-05.com.amazon:sgw-f4896c9d-tapedrive-01-lun-0

drwx------ root/root         0 2016-02-12 16:05 ./
drwx------ root/root         0 2016-01-21 20:27 ./.ssh/
-rw------- root/root       548 2016-01-21 20:27 ./.ssh/authorized_keys
-rwxr-xr-x root/root       476 2016-02-11 15:47 ./install_bareos
-rw------- root/root     56482 2016-02-12 21:21 ./.bash_history
-rw-r--r-- root/root      3106 2014-02-20 02:43 ./.bashrc

---snip---

drwx------ root/root             0 2016-02-14 13:43 ./.local/share/mc/
-rw------- root/root          2780 2016-02-14 13:43
./.local/share/mc/history
-rw-r--r-- root/root          3344 2016-02-14 13:43
./.local/share/mc/filepos
drwx------ root/root             0 2016-01-21 22:45
./.local/share/mc/mcedit/
-rw-r--r-- root/root            72 2016-01-21 22:45 ./.selected_editor
-rw-r--r-- root/root           140 2014-02-20 02:43 ./.profile


So I was able to read and write successfully to the tape using TAR.  I then
erased the tape and proceeded to run the btape basic test:

# mt -f
/dev/tape/by-path/ip-172.30.0.99:3260-iscsi-iqn.1997-05.com.amazon:sgw-f4896c9d-tapedrive-01-lun-0-nst
rewind

# mt -f
/dev/tape/by-path/ip-172.30.0.99:3260-iscsi-iqn.1997-05.com.amazon:sgw-f4896c9d-tapedrive-01-lun-0-nst
erase

# mt -f
/dev/tape/by-path/ip-172.30.0.99:3260-iscsi-iqn.1997-05.com.amazon:sgw-f4896c9d-tapedrive-01-lun-0-nst
rewind

# btape -c /etc/bareos/bareos-sd.conf
/dev/tape/by-path/ip-172.30.0.99:3260-iscsi-iqn.1997-05.com.amazon:sgw-f4896c9d-tapedrive-01-lun-0-nst

Tape block granularity is 1024 bytes.
btape: butil.c:274-0 Using device:
"/dev/tape/by-path/ip-172.30.0.99:3260-iscsi-iqn.1997-05.com.amazon:sgw-f4896c9d-tapedrive-01-lun-0-nst"
for writing.
btape: btape.c:487-0 open device "I2M-AWS-TD0"
(/dev/tape/by-path/ip-172.30.0.99:3260-iscsi-iqn.1997-05.com.amazon:sgw-f4896c9d-tapedrive-01-lun-0-nst):
OK
*test

=== Write, rewind, and re-read test ===

I'm going to write 10000 records and an EOF
then write 10000 records and an EOF, then rewind,
and re-read the data to verify that it is correct.

This is an *essential* feature ...

btape: btape.c:1172-0 Wrote 10000 blocks of 64412 bytes.
btape: btape.c:619-0 Wrote 1 EOF to "I2M-AWS-TD0"
(/dev/tape/by-path/ip-172.30.0.99:3260-iscsi-iqn.1997-05.com.amazon:sgw-f4896c9d-tapedrive-01-lun-0-nst)
btape: btape.c:1188-0 Wrote 10000 blocks of 64412 bytes.
btape: btape.c:619-0 Wrote 1 EOF to "I2M-AWS-TD0"
(/dev/tape/by-path/ip-172.30.0.99:3260-iscsi-iqn.1997-05.com.amazon:sgw-f4896c9d-tapedrive-01-lun-0-nst)
btape: btape.c:1230-0 Rewind OK.
14-Feb 14:26 btape JobId 0: Error: block.c:1003 Read error on fd=3 at
file:blk 0:0 on device "I2M-AWS-TD0"
(/dev/tape/by-path/ip-172.30.0.99:3260-iscsi-iqn.1997-05.com.amazon:sgw-f4896c9d-tapedrive-01-lun-0-nst).
ERR=Input/output error.
btape: btape.c:1250-0 Read block 1 failed! ERR=Input/output error
*quit


As you can see, once again, the write portion of the test is successful --
the two 10000-block files are written to the tape without error, and btape
also rewinds the tape without error.  But as soon as btape tries to read
back the files from the tape, it throws the EIO message and halts the test.

Just to verify that the write portion of the test actually succeeded, I
manually checked the tape:

# mt -f
/dev/tape/by-path/ip-172.30.0.99:3260-iscsi-iqn.1997-05.com.amazon:sgw-f4896c9d-tapedrive-01-lun-0-nst
status

SCSI 2 tape drive:
File number=0, block number=-1, partition=0.
Tape block size 0 bytes. Density code 0x0 (default).
Soft error count since last status=0
General status bits on (1010000):
 ONLINE IM_REP_EN

# mt -f
/dev/tape/by-path/ip-172.30.0.99:3260-iscsi-iqn.1997-05.com.amazon:sgw-f4896c9d-tapedrive-01-lun-0-nst
fsf

# mt -f
/dev/tape/by-path/ip-172.30.0.99:3260-iscsi-iqn.1997-05.com.amazon:sgw-f4896c9d-tapedrive-01-lun-0-nst
status

SCSI 2 tape drive:
File number=1, block number=0, partition=0.
Tape block size 0 bytes. Density code 0x0 (default).
Soft error count since last status=0
General status bits on (81010000):
 EOF ONLINE IM_REP_EN

# mt -f
/dev/tape/by-path/ip-172.30.0.99:3260-iscsi-iqn.1997-05.com.amazon:sgw-f4896c9d-tapedrive-01-lun-0-nst
fsf

# mt -f
/dev/tape/by-path/ip-172.30.0.99:3260-iscsi-iqn.1997-05.com.amazon:sgw-f4896c9d-tapedrive-01-lun-0-nst
status

SCSI 2 tape drive:
File number=2, block number=0, partition=0.
Tape block size 0 bytes. Density code 0x0 (default).
Soft error count since last status=0*quit
General status bits on (81010000):
 EOF ONLINE IM_REP_EN

# mt -f
/dev/tape/by-path/ip-172.30.0.99:3260-iscsi-iqn.1997-05.com.amazon:sgw-f4896c9d-tapedrive-01-lun-0-nst
fsf

/dev/tape/by-path/ip-172.30.0.99:3260-iscsi-iqn.1997-05.com.amazon:sgw-f4896c9d-tapedrive-01-lun-0-nst:
Input/output error


As expected, I was able to forward-space by file exactly twice, each time
status showing the drive positioned at the beginning of each file.  On the
third attempt, I got the expected error, as btape only wrote two files to
the tape.  I also forward-spaced by record:

# mt -f
/dev/tape/by-path/ip-172.30.0.99:3260-iscsi-iqn.1997-05.com.amazon:sgw-f4896c9d-tapedrive-01-lun-0-nst
rewind

# mt -f
/dev/tape/by-path/ip-172.30.0.99:3260-iscsi-iqn.1997-05.com.amazon:sgw-f4896c9d-tapedrive-01-lun-0-nst
fsf

# mt -f
/dev/tape/by-path/ip-172.30.0.99:3260-iscsi-iqn.1997-05.com.amazon:sgw-f4896c9d-tapedrive-01-lun-0-nst
fsr 2000

# mt -f
/dev/tape/by-path/ip-172.30.0.99:3260-iscsi-iqn.1997-05.com.amazon:sgw-f4896c9d-tapedrive-01-lun-0-nst
status

SCSI 2 tape drive:
File number=1, block number=2000, partition=0.
Tape block size 0 bytes. Density code 0x0 (default).
Soft error count since last status=0
General status bits on (1010000):
 ONLINE IM_REP_EN

# mt -f
/dev/tape/by-path/ip-172.30.0.99:3260-iscsi-iqn.1997-05.com.amazon:sgw-f4896c9d-tapedrive-01-lun-0-nst
fsr 8001

/dev/tape/by-path/ip-172.30.0.99:3260-iscsi-iqn.1997-05.com.amazon:sgw-f4896c9d-tapedrive-01-lun-0-nst:
Input/output error

Since the btape test had written 10,000 records per file, I was able to
forward-space over the first 2,000 records, but attempting to forward-space
another 8,001 records (one more record than the end of the file), I got the
expected error.  In any case, this confirms for me that btape was, indeed,
successful in writing to the tape.  I was even able to successfully
maneuver between the files and records using the commands in btape;
however, any attempt to read one or any number of blocks always throws the
EIO error.  So the only thing not working from the btape/Bareos perspective
is the read function.

Just to be sure I didn't miss anything, I ran the btape test again in full
debug mode; here is the output from the beginning of the rewind:

btape (400): generic_tape_device.c:1115-0 rewind res=0 fd=3 "I2M-AWS-TD0"
(/dev/tape/by-path/ip-172.30.0.99:3260-iscsi-iqn.1997-05.com.amazon:sgw-f4896c9d-tapedrive-01-lun-0-nst)
btape: btape.c:1230-0 Rewind OK.
btape (250): block.c:960-0 Full read in read_block_from_device() len=64512
btape (250): block.c:1000-0 Read device got: ERR=Input/output error
btape (250): sd_plugins.c:237-0 No bplugin_list: generate_plugin_event
ignored.
btape (850): message.c:1519-0 Enter Jmsg type=4
btape (850): message.c:848-0 Enter dispatch_message type=4 msg=btape JobId
0: Error: block.c:1003 Read error on fd=3 at file:blk 0:0 on device
"I2M-AWS-TD0"
(/dev/tape/by-path/ip-172.30.0.99:3260-iscsi-iqn.1997-05.com.amazon:sgw-f4896c9d-tapedrive-01-lun-0-nst).
ERR=Input/output error.
btape (850): message.c:1112-0 STDOUT for following msg: btape JobId 0:
Error: block.c:1003 Read error on fd=3 at file:blk 0:0 on device
"I2M-AWS-TD0"
(/dev/tape/by-path/ip-172.30.0.99:3260-iscsi-iqn.1997-05.com.amazon:sgw-f4896c9d-tapedrive-01-lun-0-nst).
ERR=Input/output error.
14-Feb 15:14 btape JobId 0: Error: block.c:1003 Read error on fd=3 at
file:blk 0:0 on device "I2M-AWS-TD0"
(/dev/tape/by-path/ip-172.30.0.99:3260-iscsi-iqn.1997-05.com.amazon:sgw-f4896c9d-tapedrive-01-lun-0-nst).
ERR=Input/output error.
btape: btape.c:1250-0 Read block 1 failed! ERR=Input/output error
btape (950): record.c:289-0 Enter free_record.
btape (950): record.c:293-0 Data buf is freed.
btape (950): record.c:295-0 Leave free_record.
*quit


There is still no indication of what is causing the EIO, but you can
clearly see that it happens right after the call to
read_block_from_device().  Digging into the source code, it appears that
the error happens at line 992 of block.c:

status = dev->read(block->buf, (size_t)block->buf_len);


That's as granular as I could trace it.  Whatever is happening in the call
to dev->read(...) is causing the EIO error, but there's no real indication
of what the problem is.  I have checked permissions everywhere (the
'bareos' user is, in fact, a member of 'tape' group, which has rw
permissions for all of the tape drives), and I don't see anything that
should be stopping the read function from working.  I have tailed dmesg,
syslog, and kern logs through the above processes, but nothing useful shows
up in any of them.

Any further insight or suggestions would be greatly appreciated.  Thanks!

-- 
You received this message because you are subscribed to the Google Groups 
"bareos-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to