Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

eject tape

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
0
0
Hello,

somebody know how to give a command to eject the tape from the drive?

* in a command line

* in a script file after successful tar backup

'tried tctl but no avail.

thx.
 
Did you try
mt -f /dev/rmt0.2 offline ?
^^^^^^^^^^^ The device of your tape.
 
I am also having a problem with the mt command. It seems that when I run the command:

mt -f /dev/rmt0 offline

it returns the following error 4 out of 5 times:

/dev/rmt0 offline 1 failed: The device is not ready for operation.

any help would be appreciated.
 

Just a tip:

I you set the variable TAPE=/dev/<tapedevice> you don't need to specify the device to the mt command.

Cheers
 
jdwalz - perhaps you're being a little impatient and not letting your tape drive complete a previous operation before asking it to do something else. Personally, I use

mt -f /dev/rmt0 rewoff to rewind and eject the tape. However, each to his own.
 
jdwalz,

By "4 out of 5" times, do you mean that 80% of the time you have to manually eject the tape? Or that you have to issue the command 5 times to get it to eject?

If the latter, Ken's probably right about impatience. Most tape drives I've dealt with will actually be "not ready" for a period following certain operations, even if fuser doesn't show any process with the device open.

If the former, and no matter how many times you issue the command the tape won't eject, you might try strreset.

Get the device's major and minor numbers with "ls -l /dev/rmt0", and then strreset, like so:

Code:
>ls -l /dev/rmt0
crw-rw-rw-   1 root     system    21,  0 Jun 15 19:26 /dev/rmt0
>strreset -M 21 -m 0

Note: strreset only applies to AIX 4.2 or higher.

Rod Knowlton
IBM Certified Advanced Technical Expert pSeries and AIX 5L

 
>>Personally, I use mt -f /dev/rmt0 rewoff to rewind and
>> eject the tape. However, each to his own.

The tape device rmt0 is a rewind device so it will rewind at every operation so it is not technically necessary to issue a rewind action (but it doesn't hurt either).

 
mrberry,

rmt0 is "rewind on close". If the tape was last accessed as rmt0.1, which isn't, I don't think a simple "offline" will rewind it.

Of course, another way to skin that particular cat would be to use the "retension on open" feature of certain tape special files:

mt -f /dev/rmt0.2 offline



Rod Knowlton
IBM Certified Advanced Technical Expert pSeries and AIX 5L

 
Thank you Rod, I was going to reply but this stuff called work intervened. What will they think of next to keep us from this forum? As mrberry says, no harm is done by skinning the cat twice (though the cat may have a different opinion!). Cheers.
 
Thanks for all the info on this issue and I will try all of these solutions.

RodKnowlton - What I meant is that no matter what, the tape does eject even when the error message " /dev/rmt0 offline 1 failed: The device is not ready for operation " does appeaer. I receive this notification 80% of the time.
 
>>no matter what, the tape does eject

You could edit the message catalog so that it says "Nothing to see here, ignore this error" instead. :)

Seriously, though, I hate error messages that appear when everything worked. It can't help but make me wonder what sort of errors are happening, but unreported, when everything appears to be fine.



Rod Knowlton
IBM Certified Advanced Technical Expert pSeries and AIX 5L

 
Rod, according to the tctl man page (and tctl is a hard link to mt, so they are really the same command, in AIX 5.2 anyway):

"offline or rewoffl Rewinds the tape and takes the tape drive offline."

So this would indicate weather you do an "offline" or "rewoffl" it has the same effect.

Thanks,

Mark
 
Mark,

Thanks for the correction. As soon as I saw the line you quoted, those two grey cells that remembered seeing that the two were synonyms said "Oh, yeah."

A word of caution, though. Multiple links, hard or otherwise, does not automatically mean that the commands are the same. The executable can check the name by which it was invoked and behave differently based on that information.

I thought for a second that might be the problem causing the error message, especially since "offline" is not listed on the mt man page as a valid subcommand. Looking at strings output for the executable, it doesn't look like this is the case. If it determined its behaviour based on invocation name, I'd expect to see either "mt" or "tctl" as standalone strings and the weren't there.

Rod Knowlton
IBM Certified Advanced Technical Expert pSeries and AIX 5L

 
One more twist to problem.

Once I load the media into the drive and wait until it loads then run the mt -f /dev/rmt0 rewoffl command, I still receive this error message even without running the backup. Although this does not happen all the time. I guess this could lead back to what was said about issuing the command to soon.
 
Anything in errpt? I had this problem on a new 5.2 install but it seems to have disappeared of it's own accord. No patches applied, nothing done to prevent it.
 
you must use tctl -f /dev/<tape device> rewoffl.
I also use this in my scripts.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top