Resetting a hung tape drive

Resetting a hung tape drive From: Craig_Anderson@kcbbs.gen.nz (Craig Anderson)


A process accesses the tape drive. The process stops, exits, or whatever,
but still hold on to the drive. When this happens, the process cannot be
killed by any signal and the tape drive cannot be used by any other
process until the machine is rebooted.

The following should help:

RESET:

AIX, like most UNIX systems has no reset function for tape drives. You
can however send a Bus Device Reset (a standard SCSI message) to the
tape drive using the following piece of code. If the tape drive does
not respond to the BDR, then a SCSI Bus Reset will be sent (and this
will reset every device on the SCSI Bus). SCSI Bus resets are rather
extreme so you should refrain from using this program unnecessarily.
But there are times (like after you've inserted a jammed/old/bad tape in
an 8mm drive), when there's no other way to reset the device other than
to shutdown and reboot (obviously you can power down and up an external
drive to reset it - and this would be the better choice).

This is actually documented in info, but can be hard to find and
there's no complete program.

/* taperst: resets the tape drive by sending a BDR to the drive. */
#include
#include
#include
#include

int main(int argc, char **argv)
{
/* This can be run only by root */

if (argc != 2) {
fprintf(stderr, "Usage: %s /dev/rmt#\n", argv[0]);
return 1;
}

if (openx(argv[1], O_RDONLY, 0, SC_FORCED_OPEN) < 0) {
perror(argv[0]);
return 2;
}
return 0;
}



Home FAQ