Operating System - HP-UX
1832831 Members
2944 Online
110047 Solutions
New Discussion

check the dat tape or dlt tape

 
matteo casarino
Advisor

check the dat tape or dlt tape

Hi to all,
I need to check if a DAT TAPE or DLT TAPE is ready to write o read.
Is there a ux command that returned me the state of the tape ???

Thank you
Matteo
tring open new windows of your mind
12 REPLIES 12
Sanjay_6
Honored Contributor

Re: check the dat tape or dlt tape

hi,

Try,

# mt -f /dev/rmt/0m status

Hope this helps.

Regds

Rodney Hills
Honored Contributor

Re: check the dat tape or dlt tape

I use shell code like the following-

if /usr/bin/mt -t /dev/rmt/0m rew 2>/dev/null ; then
echo "tape is mounted ..."
else
echo "tape is > > NOT < < mounted ..."
exit
fi


-- Rod Hills
There be dragons...
matteo casarino
Advisor

Re: check the dat tape or dlt tape

mt -f /dev/rmt/0m status don't work
tring open new windows of your mind
Uday_S_Ankolekar
Honored Contributor

Re: check the dat tape or dlt tape

Hi,

Try instead

mt -f /dem/rnt/0mnb status

If -f doesnot work then use -t. Look for the man pages of mt for more information on -f -t.

Some of my server doesn't support -f but works with -t.

Goodluck,
-USA..
Good Luck..
matteo casarino
Advisor

Re: check the dat tape or dlt tape

mt -t /dev/rmt/1mnb status don't work



tring open new windows of your mind
Sanjay_6
Honored Contributor

Re: check the dat tape or dlt tape

Hi,

do a "ioscan -fnC tape" and check the device file for the tape drive and then use it with the mt command.

Hope this helps.

Regds
Steve Steel
Honored Contributor

Re: check the dat tape or dlt tape

Hi


HP does not support the status option.


The rewind is the best supported solution


Steve Steel
If you want truly to understand something, try to change it. (Kurt Lewin)
Carlos Fernandez Riera
Honored Contributor

Re: check the dat tape or dlt tape

direct way ( with tape overwrite):

echo " testing write tape ..." | dd of=/dev/rmt/Xmn

if [ $? -ne 0 ] ; then

echo " tape is write protected .."

else

echo " tape is overwrite ..... :(("
fi


C code way :

#incluse
#include
main ()
{

int dat;

dat=open ("/dev/rmt/0mn", O_RDWR);

if ( dat == -1 )
{
printf (" no tape or tape protected\n");
exit (1);
}

}


unsupported
Uday_S_Ankolekar
Honored Contributor

Re: check the dat tape or dlt tape

Hi,

Try

ioscan -fnKc tape
This would display results similar to this:
Class I H/W Path Driver S/W State H/W Type Description
=====================================================================
tape 0 1/4/0/0.0.0 stape CLAIMED DEVICE QUANTUM DLT7000
/dev/rmt/0m /dev/rmt/0mnb /dev/rmt/c16t0d0BESTn
/dev/rmt/0mb /dev/rmt/c16t0d0BEST /dev/rmt/c16t0d0BESTnb
/dev/rmt/0mn /dev/rmt/c16t0d0BESTb

Then run mt -f /dev/rmt/

Good Luck..
Uday_S_Ankolekar
Honored Contributor

Re: check the dat tape or dlt tape

oops...

It should be

ioscan -fnkC tape
Good Luck..
Patrick Wallek
Honored Contributor

Re: check the dat tape or dlt tape

HP does support the 'status' option of the mt command, but only at HP-UX 11.x, I believe.

Also, the '-f ' option is only supported at 11.x, 10.x used the '-t ' option.

So, if you are at HP-UX 10.20 do something like:

# mt -t /dev/rmt/?m rew

where the ? is the appropriate number for your tape drive.

At 11.0 you can do:

# mt -f /dev/rmt/?m status

again, where ? is the appropriate number for you tape drive.
matteo casarino
Advisor

Re: check the dat tape or dlt tape

thank you all
i resolved my problem with a csh script.

tring open new windows of your mind