The FreeBSD Diary

The FreeBSD Diary (TM)

Providing practical examples since 1998

If you buy from Amazon USA, please support us by using this link.
[ HOME | TOPICS | INDEX | WEB RESOURCES | BOOKS | CONTRIBUTE | SEARCH | FEEDBACK | FAQ | FORUMS ]

Things look quiet here. But I've been doing a lot of blogging at dan.langille.org because I prefer WordPress now. Not all my posts there are FreeBSD related. I am in the midst of migrating The FreeBSD Diary over to WordPress (and you can read about that here). Once the migration is completed, I'll move the FreeBSD posts into the new FreeBSD Diary website.

Bacula - testing tape  

This page contains the results of testing a tape drive with the Bacula tool btape.

# /usr/local/sbin/btape -c /usr/local/etc/bacula-sd.conf /dev/nrsa1
Tape block granularity is 1024 bytes.
btape: butil.c:149 Using device: /dev/nrsa1 for writing.
*test


=== Append files test ===

This test is essential to Bacula.

I'm going to write one record  in file 0,
             two records in file 1,
         and three records in file 2

btape: btape.c:380 Rewound /dev/nrsa1
btape: btape.c:845 Wrote one record of 64412 bytes.
btape: btape.c:847 Wrote block to device.
btape: btape.c:403 Wrote EOF to /dev/nrsa1
btape: btape.c:845 Wrote one record of 64412 bytes.
btape: btape.c:847 Wrote block to device.
btape: btape.c:845 Wrote one record of 64412 bytes.
btape: btape.c:847 Wrote block to device.
btape: btape.c:403 Wrote EOF to /dev/nrsa1
btape: btape.c:845 Wrote one record of 64412 bytes.
btape: btape.c:847 Wrote block to device.
btape: btape.c:845 Wrote one record of 64412 bytes.
btape: btape.c:847 Wrote block to device.
btape: btape.c:845 Wrote one record of 64412 bytes.
btape: btape.c:847 Wrote block to device.
btape: btape.c:403 Wrote EOF to /dev/nrsa1
btape: btape.c:380 Rewound /dev/nrsa1
btape: btape.c:685 Now moving to end of medium.
btape: btape.c:420 Moved to end of medium.
We should be in file 3. I am at file -1. This is NOT correct!!!!

Append test failed. Attempting again.
Setting "Hardware End of Medium = no" and retrying append test.



=== Append files test ===

This test is essential to Bacula.

I'm going to write one record  in file 0,
             two records in file 1,
         and three records in file 2

btape: btape.c:380 Rewound /dev/nrsa1
btape: btape.c:845 Wrote one record of 64412 bytes.
btape: btape.c:847 Wrote block to device.
btape: btape.c:403 Wrote EOF to /dev/nrsa1
btape: btape.c:845 Wrote one record of 64412 bytes.
btape: btape.c:847 Wrote block to device.
btape: btape.c:845 Wrote one record of 64412 bytes.
btape: btape.c:847 Wrote block to device.
btape: btape.c:403 Wrote EOF to /dev/nrsa1
btape: btape.c:845 Wrote one record of 64412 bytes.
btape: btape.c:847 Wrote block to device.
btape: btape.c:845 Wrote one record of 64412 bytes.
btape: btape.c:847 Wrote block to device.
btape: btape.c:845 Wrote one record of 64412 bytes.
btape: btape.c:847 Wrote block to device.
btape: btape.c:403 Wrote EOF to /dev/nrsa1
btape: btape.c:380 Rewound /dev/nrsa1
btape: btape.c:685 Now moving to end of medium.
btape: btape.c:420 Moved to end of medium.
We should be in file 3. I am at file 3. This is correct!

Now the important part, I am going to attempt to append to the tape.

btape: btape.c:845 Wrote one record of 64412 bytes.
btape: btape.c:847 Wrote block to device.
btape: btape.c:403 Wrote EOF to /dev/nrsa1
btape: btape.c:380 Rewound /dev/nrsa1
Done appending, there should be no I/O errors

Doing Bacula scan of blocks:
1 block of 64448 bytes in file 1
End of File mark.
2 blocks of 64448 bytes in file 2
End of File mark.
3 blocks of 64448 bytes in file 3
End of File mark.
Total files=3, blocks=6, bytes = 386,688
End scanning the tape.
We should be in file 4. I am at file 3. This is NOT correct!!!!


It looks like the append failed. Attempting again.
Setting "BSF at EOM = yes" and retrying append test.


=== Append files test ===

This test is essential to Bacula.

I'm going to write one record  in file 0,
             two records in file 1,
         and three records in file 2

btape: btape.c:380 Rewound /dev/nrsa1
btape: btape.c:845 Wrote one record of 64412 bytes.
btape: btape.c:847 Wrote block to device.
btape: btape.c:403 Wrote EOF to /dev/nrsa1
btape: btape.c:845 Wrote one record of 64412 bytes.
btape: btape.c:847 Wrote block to device.
btape: btape.c:845 Wrote one record of 64412 bytes.
btape: btape.c:847 Wrote block to device.
btape: btape.c:403 Wrote EOF to /dev/nrsa1
btape: btape.c:845 Wrote one record of 64412 bytes.
btape: btape.c:847 Wrote block to device.
btape: btape.c:845 Wrote one record of 64412 bytes.
btape: btape.c:847 Wrote block to device.
btape: btape.c:845 Wrote one record of 64412 bytes.
btape: btape.c:847 Wrote block to device.
btape: btape.c:403 Wrote EOF to /dev/nrsa1
btape: btape.c:380 Rewound /dev/nrsa1
btape: btape.c:685 Now moving to end of medium.
btape: btape.c:420 Moved to end of medium.
We should be in file 3. I am at file 3. This is correct!

Now the important part, I am going to attempt to append to the tape.

btape: btape.c:845 Wrote one record of 64412 bytes.
btape: btape.c:847 Wrote block to device.
btape: btape.c:403 Wrote EOF to /dev/nrsa1
btape: btape.c:380 Rewound /dev/nrsa1
Done appending, there should be no I/O errors

Doing Bacula scan of blocks:
1 block of 64448 bytes in file 1
End of File mark.
2 blocks of 64448 bytes in file 2
End of File mark.
3 blocks of 64448 bytes in file 3
End of File mark.
1 block of 64448 bytes in file 4
End of File mark.
Total files=4, blocks=7, bytes = 451,136
End scanning the tape.
We should be in file 4. I am at file 4. This is correct!


It looks like the test worked this time, please add:

   Hardware End of Medium = No
   BSF at EOM = yes

to your Device resource in the Storage conf file.

The above Bacula scan should have output identical to what follows.
Please double check it ...
=== Sample correct output ===
1 block of 64448 bytes in file 1
End of File mark.
2 blocks of 64448 bytes in file 2
End of File mark.
3 blocks of 64448 bytes in file 3
End of File mark.
1 block of 64448 bytes in file 4
End of File mark.
Total files=4, blocks=7, bytes = 451136
=== End sample correct output ===

If the above scan output is not identical to the
sample output, you MUST correct the problem
or Bacula will not be able to write multiple Jobs to 
the tape.


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

I'm going to write three records and two eof's
then backup over the eof's and re-read the last record.
Bacula does this after writing the last block on the
tape to verify that the block was written correctly.
It is not an *essential* feature ...

btape: btape.c:380 Rewound /dev/nrsa1
btape: btape.c:587 Wrote first record of 64412 bytes.
btape: btape.c:598 Wrote second record of 64412 bytes.
btape: btape.c:609 Wrote third record of 64412 bytes.
btape: btape.c:403 Wrote EOF to /dev/nrsa1
btape: btape.c:403 Wrote EOF to /dev/nrsa1
btape: btape.c:621 Backspaced over two EOFs OK.
btape: btape.c:626 Backspace record OK.
btape: btape.c:642 
Block re-read correct. Test succeeded!
=== End Write, backup, and re-read test ===


=== End Append files test ===
*
The good news is no problems. The bad news, if you can call it that, is btape has made some suggestions for improvement. I altered my storage device to include the following:
   Hardware End of Medium = No
   BSF at EOM = yes