- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Tape error messages
Categories
Company
Local Language
Forums
Discussions
Knowledge Base
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-12-2001 12:57 AM
09-12-2001 12:57 AM
Tape error messages
Let me try another question, the last one worked out well!
Before we run our backup, we check for the presence of a tape in the drive using the following command:
mt -t $DLT_TAPE rew
Now there are a couple of possible scenarios for the error output, does anyone have a script that catches these error messages ($?), and connects this to a human readable error message?
Thanks in advance,
Robert
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-12-2001 01:02 AM
09-12-2001 01:02 AM
Re: Tape error messages
mt -t $DLT_TAPE rew 2>/tmp/errlog
if [ `wc -l` -ne 0 ]
then
#Here you can check for various errors and echo
#human readable. Else if you just want to
#print the error
cat /tmp/errlog
rm /tmp/errlog
fi
-Sri
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-12-2001 01:24 AM
09-12-2001 01:24 AM
Re: Tape error messages
Can anyone give some more assistance?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-12-2001 01:28 AM
09-12-2001 01:28 AM
Re: Tape error messages
The only error codes you can really get from using the mt command are 0 (success) or 1 (failure).
So;
mt -t /dev/rmt/0m rew
if [ $? -ne 0 ]
then
echo Either no tape in the drive or tape in use.
fi
The only question is how to test the tape in the drive is writeable ? Doing a rewind will not detect a non-writeable tape. Perhaps you would want to do a write test to the tape also to check its writeable ? (use something like echo > /dev/rmt/0m )
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-12-2001 06:42 AM
09-12-2001 06:42 AM
Re: Tape error messages
Try compiling the following. Basically the "mt_gstat" field is defined in /usr/include/sys/mtio.h and defines the state (including write protect status) of the tape/drive. You'll probably want to play with this to get what you want, but it's a start:
Rgds, Robin
======================================
#include
#include
#include
#include
#include
#include
int main(int argc,char *argv[])
{
/* int argc;
char *argv[]; */
struct mtget mtget;
struct mtop mtop;
char *dev="/dev/rmt/3hcn";
int fd;
if (argc > 2)
{
fprintf(stderr, "Usage: %s
exit(1);
}
if (argc == 2)
dev=argv[1];
/* open the device */
if ((fd=open(dev,O_RDWR))<0)
{
/* printf("\nfd ERROR = %d\n",errno); */
perror("open failed");
exit(errno);
}
if ((ioctl(fd,MTIOCGET,&mtget))<0)
{
perror("ioctl(MTIOCGET) failed");
exit(errno);
}
printf("\nmt_gstat = %x\n",mtget.mt_gstat);
/* else
{
printf("\nmt_gstat = %x\n",mtget.mt_gstat);
if (GMT_BOT(mtget.mt_gstat))
printf("BOT\n");
else if (GMT_EOT(mtget.mt_gstat))
printf("EOT\n");
} */
exit(0) ;
}
==========================================