Skip to content

Instantly share code, notes, and snippets.

@KenwoodFox
Created July 22, 2020 04:41
Show Gist options
  • Save KenwoodFox/24f061afeaef0a813a290d65eede3c17 to your computer and use it in GitHub Desktop.
Save KenwoodFox/24f061afeaef0a813a290d65eede3c17 to your computer and use it in GitHub Desktop.
root@Bacula-Iron2:/ # btape /dev/nsa0
Tape block granularity is 1024 bytes.
btape: butil.c:290-0 Using device: "/dev/nsa0" for writing.
22-Jul 00:39 btape JobId 0: 3991 Bad autochanger "loaded? drive 0" command: ERR=No such file or directory.
Results=
22-Jul 00:39 btape JobId 0: 3991 Bad autochanger "loaded? drive 0" command: ERR=No such file or directory.
Results=
btape: btape.c:478-0 open device "Drive-0-LTO-3" (/dev/nsa0): 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:1161-0 Wrote 10000 blocks of 64412 bytes.
btape: btape.c:612-0 Wrote 1 EOF to "Drive-0-LTO-3" (/dev/nsa0)
btape: btape.c:1177-0 Wrote 10000 blocks of 64412 bytes.
btape: btape.c:612-0 Wrote 1 EOF to "Drive-0-LTO-3" (/dev/nsa0)
btape: btape.c:1219-0 Rewind OK.
10000 blocks re-read correctly.
Got EOF on tape.
10000 blocks re-read correctly.
=== Test Succeeded. End Write, rewind, and re-read test ===
btape: btape.c:1286-0 Block position test
btape: btape.c:1297-0 Rewind OK.
Reposition to file:block 0:4
Block 5 re-read correctly.
Reposition to file:block 0:200
Block 201 re-read correctly.
Reposition to file:block 0:9999
Block 10000 re-read correctly.
Reposition to file:block 1:0
Block 10001 re-read correctly.
Reposition to file:block 1:600
Block 10601 re-read correctly.
Reposition to file:block 1:9999
Block 20000 re-read correctly.
=== Test Succeeded. End Write, rewind, and re-read 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:582-0 Rewound "Drive-0-LTO-3" (/dev/nsa0)
btape: btape.c:1917-0 Wrote one record of 64412 bytes.
btape: btape.c:1919-0 Wrote block to device.
btape: btape.c:612-0 Wrote 1 EOF to "Drive-0-LTO-3" (/dev/nsa0)
btape: btape.c:1917-0 Wrote one record of 64412 bytes.
btape: btape.c:1919-0 Wrote block to device.
btape: btape.c:1917-0 Wrote one record of 64412 bytes.
btape: btape.c:1919-0 Wrote block to device.
btape: btape.c:612-0 Wrote 1 EOF to "Drive-0-LTO-3" (/dev/nsa0)
btape: btape.c:1917-0 Wrote one record of 64412 bytes.
btape: btape.c:1919-0 Wrote block to device.
btape: btape.c:1917-0 Wrote one record of 64412 bytes.
btape: btape.c:1919-0 Wrote block to device.
btape: btape.c:1917-0 Wrote one record of 64412 bytes.
btape: btape.c:1919-0 Wrote block to device.
btape: btape.c:612-0 Wrote 1 EOF to "Drive-0-LTO-3" (/dev/nsa0)
22-Jul 00:40 btape JobId 0: 3991 Bad autochanger "loaded? drive 0" command: ERR=No such file or directory.
Results=
btape: btape.c:478-0 open device "Drive-0-LTO-3" (/dev/nsa0): OK
btape: btape.c:582-0 Rewound "Drive-0-LTO-3" (/dev/nsa0)
btape: btape.c:1430-0 Now moving to end of medium.
btape: btape.c:630-0 tape_dev.c:364 ioctl MTIOCGET error on "Drive-0-LTO-3" (/dev/nsa0). ERR=No error: 0.
We should be in file 3. I am at file 0. This is NOT correct!!!!
Append test failed. Attempting again.
Setting "Hardware End of Medium = no
and "Fast Forward Space File = 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:582-0 Rewound "Drive-0-LTO-3" (/dev/nsa0)
btape: btape.c:1917-0 Wrote one record of 64412 bytes.
btape: btape.c:1919-0 Wrote block to device.
btape: btape.c:612-0 Wrote 1 EOF to "Drive-0-LTO-3" (/dev/nsa0)
btape: btape.c:1917-0 Wrote one record of 64412 bytes.
btape: btape.c:1919-0 Wrote block to device.
btape: btape.c:1917-0 Wrote one record of 64412 bytes.
btape: btape.c:1919-0 Wrote block to device.
btape: btape.c:612-0 Wrote 1 EOF to "Drive-0-LTO-3" (/dev/nsa0)
btape: btape.c:1917-0 Wrote one record of 64412 bytes.
btape: btape.c:1919-0 Wrote block to device.
btape: btape.c:1917-0 Wrote one record of 64412 bytes.
btape: btape.c:1919-0 Wrote block to device.
btape: btape.c:1917-0 Wrote one record of 64412 bytes.
btape: btape.c:1919-0 Wrote block to device.
btape: btape.c:612-0 Wrote 1 EOF to "Drive-0-LTO-3" (/dev/nsa0)
22-Jul 00:40 btape JobId 0: 3991 Bad autochanger "loaded? drive 0" command: ERR=No such file or directory.
Results=
btape: btape.c:478-0 open device "Drive-0-LTO-3" (/dev/nsa0): OK
btape: btape.c:582-0 Rewound "Drive-0-LTO-3" (/dev/nsa0)
btape: btape.c:1430-0 Now moving to end of medium.
btape: btape.c:633-0 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.
22-Jul 00:40 btape JobId 0: [SI0202] End of Volume "" at 3:0 on device "Drive-0-LTO-3" (/dev/nsa0). Write of 64512 bytes got 0.
22-Jul 00:40 btape JobId 0: Error: Re-read last block at EOT failed. ERR=block.c:581 Read zero bytes Vol= at 0:193536 on device "Drive-0-LTO-3" (/dev/nsa0).
btape: btape.c:1914-0 Error writing block to device.
btape: Fatal Error at tape_dev.c:945 because:
tape_dev.c:944 Attempt to WEOF on non-appendable Volume
22-Jul 00:40 btape: Fatal Error at tape_dev.c:945 because:
tape_dev.c:944 Attempt to WEOF on non-appendable Volume
btape: btape.c:608-0 Bad status from weof. ERR=tape_dev.c:944 Attempt to WEOF on non-appendable Volume
btape: btape.c:582-0 Rewound "Drive-0-LTO-3" (/dev/nsa0)
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:582-0 Rewound "Drive-0-LTO-3" (/dev/nsa0)
btape: block.c:163-0 [SF0205] Attempt to write on read-only Volume. dev="Drive-0-LTO-3" (/dev/nsa0)
22-Jul 00:40 btape JobId 0: Fatal error: block.c:163 [SF0205] Attempt to write on read-only Volume. dev="Drive-0-LTO-3" (/dev/nsa0)
btape: btape.c:1914-0 Error writing block to device.
btape: Fatal Error at tape_dev.c:945 because:
tape_dev.c:944 Attempt to WEOF on non-appendable Volume
22-Jul 00:40 btape: Fatal Error at tape_dev.c:945 because:
tape_dev.c:944 Attempt to WEOF on non-appendable Volume
btape: btape.c:608-0 Bad status from weof. ERR=tape_dev.c:944 Attempt to WEOF on non-appendable Volume
btape: btape.c:1914-0 Error writing block to device.
btape: btape.c:1914-0 Error writing block to device.
btape: Fatal Error at tape_dev.c:945 because:
tape_dev.c:944 Attempt to WEOF on non-appendable Volume
22-Jul 00:40 btape: Fatal Error at tape_dev.c:945 because:
tape_dev.c:944 Attempt to WEOF on non-appendable Volume
btape: btape.c:608-0 Bad status from weof. ERR=tape_dev.c:944 Attempt to WEOF on non-appendable Volume
btape: btape.c:1914-0 Error writing block to device.
btape: btape.c:1914-0 Error writing block to device.
btape: btape.c:1914-0 Error writing block to device.
btape: Fatal Error at tape_dev.c:945 because:
tape_dev.c:944 Attempt to WEOF on non-appendable Volume
22-Jul 00:40 btape: Fatal Error at tape_dev.c:945 because:
tape_dev.c:944 Attempt to WEOF on non-appendable Volume
btape: btape.c:608-0 Bad status from weof. ERR=tape_dev.c:944 Attempt to WEOF on non-appendable Volume
22-Jul 00:40 btape JobId 0: 3991 Bad autochanger "loaded? drive 0" command: ERR=No such file or directory.
Results=
btape: btape.c:478-0 open device "Drive-0-LTO-3" (/dev/nsa0): OK
btape: btape.c:582-0 Rewound "Drive-0-LTO-3" (/dev/nsa0)
btape: btape.c:1430-0 Now moving to end of medium.
btape: btape.c:633-0 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:1914-0 Error writing block to device.
btape: btape.c:612-0 Wrote 1 EOF to "Drive-0-LTO-3" (/dev/nsa0)
btape: btape.c:582-0 Rewound "Drive-0-LTO-3" (/dev/nsa0)
Done appending, there should be no I/O errors
Doing Bacula scan of blocks:
btape: block.c:460-0 Job failed or canceled.
Error reading block. ERR=Job failed or canceled.
Total files=0, blocks=0, bytes = 0
End scanning the tape.
We should be in file 4. I am at file 0. This is NOT correct!!!!
Append test failed.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Unable to correct the problem. You MUST fix this
problem before Bacula can use your tape drive correctly
Perhaps running Bacula in fixed block mode will work.
Do so by setting:
Minimum Block Size = nnn
Maximum Block Size = nnn
in your Storage daemon's Device definition.
nnn must match your tape driver's block size, which
can be determined by reading your tape manufacturers
information, and the information on your kernel dirver.
Fixed block sizes, however, are not normally an ideal solution.
Some systems, e.g. OpenBSD, require you to set
Use MTIOCGET= no
in your device resource. Use with caution.
*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment