How can non-NetBackup applications and utilities read and write tapes when NetBackup requires that it has sole access to the tape drives?
When NetBackup is installed, it comes with Media Manager. This is configured to manage the tape library, mounting and dismounting of tapes and drive access control. By default, if any other utility or application tries to access any of these resources outside of Media Manager control, problems occur; drives will be marked as DOWN, backups will fail, mounts or dismounts may fail as well as the intended user operation failing.
One method which is often used to resolve this conflict is to DOWN the drive manually, either from the command line with the vmoprcmd command or from the Device Monitor GUI. While this addresses the conflict of interest in the drive between Media Manger and the utility, it is unattractive for a number of reasons. Firstly, the user must remember to UP the drive when they have finished. If the user doesn't UP the drive, NetBackup will not use that drive. Secondly, the user is still left with the problem of how to get the tape mounted and dismounted. Finally, the user must be sure not to select the wrong tape, otherwise the user could over-write a NetBackup tape.
A more secure and reliable method is to use Media Manager for the entire process. The essence is to use the tpreq and tpunmount commands to mount and dismount tapes and get sole access to a drive while that tape is mounted. By using these commands, the user informs Media Manager that the user wants to access a tape directly. Media Manager will mount the requested tape in a drive of its choice, then create a symlink to the actual tape device from a file specified by the user.
Further, by grouping all the tapes for use with a utility or application into a media pool, the chance of the wrong tape being used is further reduced. Consider the following example.
The administrator has been sent a DLT tape from a supplier which is in CPIO format. The tape has been inserted into the library and added to the CPIO pool. It has bar code A00001. To read the tape, the commands would be:
# Set the path to include the Media Manager commands.
PATH=$PATH:/usr/openv/volmgr/bin; export PATH
# Mount the first tape. Link the actual tape drive used to a tmp file called mytape.
# Note: the syntax of the tpreq command changed with the release on NetBackup 4.5.
# For versions of NetBackup prior to 4.5, use:
tpreq -ev A00001 -d dlt -p CPIO -f /tmp/mytape
# For NetBackup 4.5 and later use:
tpreq -m A00001 -d dlt -p CPIO -f /tmp/mytape
# The tape is now mounted. You can reference /tmp/mytape as the tape device. It is linked to the non-rewind device, so its always best to force a rewind first and
at the end.
mt -f /tmp/mytape rewind
# Now read the tape.
cpio -idvum < /tmp/tape
# Tape was read. Now rewind and then tell Media Manager you've finished with it and ask for it to be
mt -f /tmp/mytape rewind