rendered paste body[dan@polo:~] $ sudo ~/bin/dlt sa0
Password:
The tape is 'sa0'
Corrected errors with substantial delay: 0
Corrected errors with possible delay : 0
Total errors : 6
Total errors corrected : 6
Total times correction algorithm used : 0
Total bytes processed : 1885205520
Total corrected errors / GB : 3
Total uncorrected errors : 0
Write compression ratio : 215%
Host requested Mbytes written : 3070
Host requested kbytes written residual : 84992
On tape Mbytes written : 1426
On tape kbytes written residual : 0
[dan@polo:~] $
$ cat ~/bin/dlt
#!/bin/sh
# Print some write statistics
#
dlt_write_statistics () {
local tmp
set -- `camcontrol cmd $tape -v -t 3 -c "4d 0 42 0 0 0 0 0 40 0" -i 64 \
"{skip} *i4 \
{skip} *i4 \
{Corrected errors with substantial delay } i4 \
{skip} *i4 \
{Corrected errors with possible delay } i4 \
{skip} *i4 \
{Total errors } i4 \
{skip} *i4 \
{Total errors corrected } i4 \
{skip} *i4 \
{Total times correction algorithm processed} i4 \
{skip} *i4 \
{Total bytes processed } i2 i3 i3 \
{skip} *i4 \
{Total uncorrected errors } i4"
`
echo " Corrected errors with substantial delay: $1" >&2
echo " Corrected errors with possible delay : $2" >&2
echo " Total errors : $3" >&2
echo " Total errors corrected : $4" >&2
echo " Total times correction algorithm used : $5" >&2
tmp=`echo "($6 * 16777216 + $7) * 16777216 + $8" | bc`
echo " Total bytes processed : $tmp" >&2
if [ $tmp != 0 ]; then
tmp=`echo "$4 * 1073741824 / $tmp" | bc`
else
tmp='N/A'
fi
echo -n " $tmp" >> /tmp/backup_$tape-errors_per_gb
echo " Total corrected errors / GB : $tmp" >&2
echo " Total uncorrected errors : $9" >&2
set -- `camcontrol modepage $tape -m 15 -P 0 | grep 'Data Compression Enabled:'`
tmp=" "
[ "x$4" = x0 ] && tmp="(disabled)"
set -- `camcontrol cmd $tape -v -t 3 -c "4d 0 72 0 0 0 0 0 4c 0" -i 76 \
"{skip} *i4 \
{skip} *i4 \
{Read compression ratio (* 100 %) } i2 \
{skip} *i4 \
{Write compression ratio (* 100 %) } i2 \
{skip} *i4 \
{Total host Mbytes reads } i4 \
{skip} *i4 \
{Total host kbytes read residual } i4 \
{skip} *i4 \
{On tape Mbytes read } i4 \
{skip} *i4 \
{On tape kbytes read residual } i4 \
{skip} *i4 \
{Host requested Mbytes written } i4 \
{skip} *i4 \
{Host requested kbytes written residual } i4 \
{skip} *i4 \
{On tape Mbytes written } i4 \
{skip} *i4 \
{On tape kbytes written residual } i4"
`
echo " Write compression ratio $tmp : $2%" >&2
echo " Host requested Mbytes written : $7" >&2
echo " Host requested kbytes written residual : $8" >&2
echo " On tape Mbytes written : $9" >&2
shift 9
echo " On tape kbytes written residual : $1" >&2
}
# Print some read statistics
#
dlt_read_statistics () {
local tmp
set -- `camcontrol cmd $tape -v -t 3 -c "4d 0 43 0 0 0 0 0 40 0" -i 64 \
"{skip} *i4 \
{skip} *i4 \
{Corrected errors with substantial delay } i4 \
{skip} *i4 \
{Corrected errors with possible delay } i4 \
{skip} *i4 \
{Total errors } i4 \
{skip} *i4 \
{Total errors corrected } i4 \
{skip} *i4 \
{Total times correction algorithm processed} i4 \
{skip} *i4 \
{Total bytes processed } i2 i3 i3 \
{skip} *i4 \
{Total uncorrected errors } i4"
`
echo " Corrected errors with substantial delay: $1" >&2
echo " Corrected errors with possible delay : $2" >&2
echo " Total errors : $3" >&2
echo " Total errors corrected : $4" >&2
echo " Total times correction algorithm used : $5" >&2
tmp=`echo "($6 * 16777216 + $7) * 16777216 + $8" | bc`
echo " Total bytes processed : $tmp" >&2
if [ $tmp != 0 ]; then
tmp=`echo "$4 * 1073741824 / $tmp" | bc`
else
tmp='N/A'
fi
echo -n " $tmp" >> /tmp/backup_$tape-errors_per_gb
echo " Total corrected errors / GB : $tmp" >&2
echo " Total uncorrected errors : $9" >&2
set -- `camcontrol modepage $tape -m 15 -P 0 | grep 'Data Compression Enabled:'`
tmp=" "
[ "x$4" = x0 ] && tmp="(disabled)"
set -- `camcontrol cmd $tape -v -t 3 -c "4d 0 72 0 0 0 0 0 4c 0" -i 76 \
"{skip} *i4 \
{skip} *i4 \
{Read compression ratio (* 100 %) } i2 \
{skip} *i4 \
{Write compression ratio (* 100 %) } i2 \
{skip} *i4 \
{Total host Mbytes reads } i4 \
{skip} *i4 \
{Total host kbytes read residual } i4 \
{skip} *i4 \
{On tape Mbytes read } i4 \
{skip} *i4 \
{On tape kbytes read residual } i4 \
{skip} *i4 \
{Host requested Mbytes written } i4 \
{skip} *i4 \
{Host requested kbytes written residual } i4 \
{skip} *i4 \
{On tape Mbytes written } i4 \
{skip} *i4 \
{On tape kbytes written residual } i4"
`
echo " Read compression ratio $tmp : $1%" >&2
echo " On tape Mbytes read : $5" >&2
echo " On tape kbytes read residual : $6" >&2
}
tape=$1
echo "The tape is '$1'"
#dlt_read_statistics
dlt_write_statistics
[dan@polo:~] $