TITLE : Howto determine the block size and format of an unknown tape OS LEVEL : AIX DATE : 04/03/99 VERSION : 1.0 ---------------------------------------------------------------------------- 1, Configure that tape drive for variable block size chdev -l rmt0 -a block_size=0 2, Read in a single block from the tape and write it to disk dd if=/dev/rmt0 of=/tmp/testblock bs=128k count=1 3, Find out the block size by counting the bytes in the file wc -c /tmp/testblock 4, Find out what the data format the file is file /tmp/testblock (This will tell if the file is a tar, cpio or backup format, will only work on AIX 4.1 upwards). Below is a shell script for a command called lstape, that will perform all the above tests. -------------first-line-of-the-shell-script-is-below-this-line------------- #!/bin/ksh # # lstape - lists a tapes block size # # You can find the tape block size by configuring the device to # accept a very large block, performing a single read, and measuring # the size of the read block. # if [ $# -ne 1 ]; then echo "Useage : lstape device-name" exit 1 fi # # Check the name and put it in standard format # if [[ "$1" = /dev/* ]]; then TAPE=${1##/dev/} else TAPE=$1 fi # # Set the blocksize to variable length # chdev -l ${TAPE} -a block_size=0 > /dev/null if [ $? -ne 0 ]; then exit 1 fi # # Read a single block and write to /tmp # dd if=/dev/${TAPE} bs=128k of=/tmp/1st$$ count=1 if [ $? -ne 0 ]; then rm -f /tmp/1st$$ exit 1 fi # # Get the blocksize from the resultant file # wc -c /tmp/1st$$ | read SIZE FILE echo "$TAPE: ${SIZE} bytes per block." if [ -x /usr/bin/file ]; then file /tmp/1st$$ | sed -e "s!/tmp/1st$$!/dev/${TAPE}!" fi rm -f /tmp/1st$$ exit 0 ------------the-last-line-of-the-shell-script-is-above-this-line---------