btape

This program permits a number of elementary tape operations via a tty command interface. It works only with tapes and not with other kinds of Bacula storage media (DVD, File, etc). The test command, described below, can be very useful for testing older tape drive compatibility problems. Aside from initial testing of tape drive compatibility with Bacula, btape will be mostly used by developers writing new tape drivers.

btape can be dangerous to use with existing Bacula tapes because it will relabel a tape or write on the tape if so requested regardless that the tape may contain valuable data, so please be careful and use it only on blank tapes.

To work properly, btape needs to read the Storage daemon’s configuration file. As a default, it will look for bacula-sd.conf in the current directory. If your configuration file is elsewhere, please use the -c option to specify where.

The physical device name must be specified on the command line, and this same device name must be present in the Storage daemon’s configuration file read by btape

Usage: btape <options> <device_name>
    -b <file> specify bootstrap file
    -c <file> set configuration file to file
    -d <nn> set debug level to nn
    -p proceed inspite of I/O errors
    -s turn off signals
    -v be verbose
    -? print this message.

Using btape to Verify Tape Drive

An important reason for this program is to ensure that a Storage daemon configuration file is defined so that Bacula will correctly read and write tapes.

It is highly recommended that you run the test command before running your first Bacula job to ensure that the parameters you have defined for your storage device (tape drive) will permit Bacula to function properly. You only need to mount a blank tape, enter the command, and the output should be reasonably self explanatory.

btape Commands

The full list of commands are:

Command     Description
=======     ===========
autochanger test autochanger
bsf                 backspace file
bsr                 backspace record
cap                 list device capabilities
clear               clear tape errors
eod                 go to end of Bacula data for append
eom                 go to the physical end of medium
fill                fill tape, write onto second volume
unfill              read filled tape
fsf                 forward space a file
fsr                 forward space a record
help                print this command
label               write a Bacula label to the tape
load                load a tape
quit                quit btape
rawfill     use write() to fill tape
readlabel   read and print the Bacula tape label
rectest     test record handling functions
rewind              rewind the tape
scan read() tape block by block to EOT and report
scanblocks  Bacula read block by block to EOT and report
speed               report drive speed
status              print tape status
test                General test Bacula tape functions
weof                write an EOF on the tape
wr                  write a single Bacula block
rr                  read a single record
qfill               quick fill command

The most useful commands are:

test

test writing records and EOF marks and reading them back.

fill

completely fill a volume with records, then write a few records on a second volume, and finally, both volumes will be read back. This command writes blocks containing random data, so your drive will not be able to compress the data, and thus it is a good test of the real physical capacity of your tapes.

readlabel

read and dump the label on a Bacula tape.

cap

list the device capabilities as defined in the configuration file and as perceived by the Storage daemon.

The readlabel command can be used to display the details of a Bacula tape label. This can be useful if the physical tape label was lost or damaged.

In the event that you want to relabel a Bacula, you can simply use the label command which will write over any existing label. However, please note for labeling tapes, we recommend that you use the label command in the Console program since it will never overwrite a valid Bacula tape.

Testing Tape Drive

See Test the Tape Drive Device With Btape Utility.

To determine the best configuration of your tape drive, you can run the new speed command available in the btape program.

This command can have the following arguments:

file_size=n

Specify the Maximum File Size for this test (between 1 and 5GB). This counter is in GB.

nb_file=n

Specify the number of file to be written. The amount of data should be greater than your memory (file_size * nb_file).

skip_zero

This flag permits to skip tests with constant data.

skip_random

This flag permits to skip tests with random data.

skip_raw

This flag permits to skip tests with raw access.

skip_block

This flag permits to skip tests with Bacula block access.

*speed file_size=3 skip_raw
btape.c:1078 Test with zero data and bacula block structure.
btape.c:956 Begin writing 3 files of 3.221 GB with blocks of 129024 bytes.
++++++++++++++++++++++++++++++++++++++++++
btape.c:604 Wrote 1 EOF to "Drive-0" (/dev/nst0)
btape.c:406 Volume bytes=3.221 GB. Write rate = 44.128 MB/s
...
btape.c:383 Total Volume bytes=9.664 GB. Total Write rate = 43.531 MB/s
btape.c:1090 Test with random data, should give the minimum throughput.
btape.c:956 Begin writing 3 files of 3.221 GB with blocks of 129024 bytes.
+++++++++++++++++++++++++++++++++++++++++++
btape.c:604 Wrote 1 EOF to "Drive-0" (/dev/nst0)
btape.c:406 Volume bytes=3.221 GB. Write rate = 7.271 MB/s
+++++++++++++++++++++++++++++++++++++++++++
...
btape.c:383 Total Volume bytes=9.664 GB. Total Write rate = 7.365 MB/s

When using compression, the random test will give your the minimum throughput of your drive . The test using constant string will give you the maximum speed of your hardware chain. (cpu, memory, scsi card, cable, drive, tape).

You can change the block size in the Storage Daemon configuration file.

See also

Go back to:

Go to:

Go back to the Tape/Volume Management chapter.

Go back to the main Bacula Enterprise Management page.