Databases
cancel
Showing results for 
Search instead for 
Did you mean: 

Getting Status of a DLT Drive

SOLVED
Go to solution

Getting Status of a DLT Drive

I have a script that perform daily backup using fbackup. From time to time, I get an error message as follow:
fbackup(3041): output file /dev/rmt/1m is currently being used and not available

I suspect that the drive is doing some work on the tape when it is loaded. Is there a way I can query the drive controller for a status before I launch the fbackup program ?

Thanks,

Chris
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures,will the right answers come out?' -- Charles Babbage
11 REPLIES
Rick Garland
Honored Contributor

Re: Getting Status of a DLT Drive

the mt -f /dev/dsk/cXt6XdX stat command

Or the mc command

Depends on version

Re: Getting Status of a DLT Drive

Rick,

I checked both commands mt and mc (I have both on my system). None of them really gives me the status i need. Although, mc -r provides what man call a status of a slot (FULL, EMPTY,NONE).

What i really need to query is if the drive is actually doing someting or if it is in ready mode.

My version is HP-UX 10.20

Thanks,

Chris
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures,will the right answers come out?' -- Charles Babbage
John Palmer
Honored Contributor
Solution

Re: Getting Status of a DLT Drive

What I do is to attempt to rewind the tape (mt rewind command) and check the response - 0=ok otherwise failed.

You can put this in a shell loop until success.

You are right about the DLT drive, it can spend quite a time after loading a tape (especially a new one).
Rick Garland
Honored Contributor

Re: Getting Status of a DLT Drive

I show mt to be in /usr/bin.

If you were to do 'man mt' does anything come up?

The syntax would be something like 'mt -t /dsv/rmt/0m stat'
replace the 0m with whatever the the tape device would be.

Re: Getting Status of a DLT Drive

Rick,

It also shows in /usr/bin/mt,
yes, 'man mt' come up. But there are no stat command option in the documentation.
if i run 'mt -t /dev/rmt/1m stat' the message i get is the following:
mt: unknown command "stat"

Thanks for your help, I appreciate.

Chris
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures,will the right answers come out?' -- Charles Babbage
Tom Danzig
Honored Contributor

Re: Getting Status of a DLT Drive

I don't think the "status" option for mt is available on HPUX 10.20 if that's what your running. The mt rew is probably you're best bet. If the drive is ready, it prints nothing and exits with status 0. If the drive is busy, it states so ("device busy") to standard output and returns non-zero (exit code 1 I believe).
James R. Ferguson
Acclaimed Contributor

Re: Getting Status of a DLT Drive

Hi:

I just checked this on a K570 running 10.20. First, the 'stat' option isn't documented.

On EITHER a DSS or DLT drive the messages returned from the operation: '/usr/bin/mt -t /dev/rmt/0m stat' are as follows (by case):


1. No tape -> /dev/rmt/0m: no such device or address

2. Tape in but not write-enabled -> /dev/rmt/0m: permission denied

3. Tape in and is write-enabled -> /Status 1 failed: invalid argument

In EVERY case the return code is one (1)

Clearly you can't rely on the exit code in 10.20. I suppost you could capture the error messages and act based on those, but this sure seems like a kludge. Regards!

...JRF...
Carlos Fernandez Riera
Honored Contributor

Re: Getting Status of a DLT Drive

i was rewieving ...

1- mt stat is included in a patch available on ITRC

2- Use stm to get status of drive. also you can automatize this job. See : pam800200009131 Want to take a quick look at your Disk error Logs?

on HP Support Information Digests
unsupported

Re: Getting Status of a DLT Drive

Hi Carlos,

I searched for pam800200009131, using the SEARCH in the ITRC. I might not looking at the right place (I'm a rookie in the marvelous world of HP!). Can you tell
me where to look ?

Basically what i want to do, is to make sure the tape drive is ready before i initiate the fbackup; otherwise i keep getting an error message telling me that the tape drive is
currently in use by another process, which is not true (i figured that the drive is still
winding the tape at that point of time).

Thanks everyone for your help!
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures,will the right answers come out?' -- Charles Babbage
Carlos Fernandez Riera
Honored Contributor

Re: Getting Status of a DLT Drive

박수정
Advisor

Re: Getting Status of a DLT Drive

Hi!

Chack your tape device and tape

1. Check your tape device!
# ioscan -kfnC tape

...
/dev/rmt/0m
/dev/rmt/1m
....

2. Check your tape device status
# mt -f /dev/rmt/0m stat
# mt -f /dev/rmt/1m stat

3. fbackup command test for each device
# fbackup -i /tmp -f /dev/rmt/0m
# fbackup -i /tmp -f /dev/rmt/1m