Scsi tape sense codes, getting last n (10)

Henry Miller hmiller at
Fri Oct 22 07:25:55 PDT 2004

I'm looking for a way to trace all sense codes come back from a tape
drive in Freebsd 4.9.  (latter we will go to 5.3, but 4.9 matters

The programs we use do not check sense codes, much less show them.  In
theory they could issue a command that fails, then issue a second
command that also fails.  The second failure will cause the sense code
from the first failure to be lost. (yes there are separate control and
io errors, but if they are both the same type that doesn't help)  My
boss does not trust these programs to stop after the first error, so
issuing ioctl MTIOCERRSTAT after the program completes is not enough.

Therefore I'm looking for some way to hook scsi (/dev/nsa0 in
particular) so that I can log sense codes as they occurs, if there are
any.  Does anyone know of a way to do this?  I didn't see anything in
the source.   We do not want to modify the kernel, or the other

I'm also working with the drive manufacture, but so far I have not
discovered anything that seems useful.  (We are only interested in one

I think that these programs just stop if there is any error we would
care about, but that is not enough.  I don't write the requirements,
and checking for sense codes after we run the program program does not
meet them.

Perhaps this could be asked on -scsi, but this isn't a Freebsd issue,
just something that runs on top of Freebsd.

More information about the freebsd-questions mailing list