Monday, March 19, 2012

Labeling Individual Tape Media in OSVault

When adding new media to a tape library, you can always just put the media into unused storage slots using the importmedia CLI command, and then run "check_inventory -l /dev/sg# -f" to find that new media and internally label it.

However, sometimes you need to just put one piece of media in a library, or you just want to check the label written on a tape with the barcode affixed to the tape cartridge, or you want to overwrite the internal label on the tape.

KEEP IN MIND: If you overwrite the internal label on a tape, all files stored on that tape will be permanently lost.

There is an option to the "tape_inv" command to check just one piece of media.  If you run "tape_inv -l /dev/sg# -v VOLUMENAME -d drivename", substituting the volume name you wish to check, OSVault will search the library storage slots and import slots for that barcode label, and then will load that tape cartridge into the first drive and check for an internal tape label.  You must specify the drive name of the first drive, found in the output of the "listdrives" command.

Without any other options, running this command will just load the tape cartridge, read the internal label, and then return the tape to the storage/import slot it came from.

If you specify the "-f" flag to tape_inv, such as "tape_inv -l /dev/sg# -v A000001L5 -d /dev/st1 -f", the media will be loaded, and if not already labelled it will be labelled internally with the same label as the barcode on the outside of the tape cartridge.  This option might be easier to use than the "check_inventory" command at times.

If you wish to recycle an empty tape, you can use the "tape_inv" command to overwrite the existing label with a new label, with the "-f -x -x" option.  The two "-x" flags are required to indicate that you really mean to do this destructive operation.  Once this command completes, the tape media is empty in that cartridge, and future writes will start at the beginning of the tape.  It is also necessary to reset the tape cartridge's database entry to start using that tape again.  A command such as
   mysql -e "update archive.media set Free_Space=\"1666704934\" where Label=\"A00001L5\""
will set the free space on the tape to the default for LTO-5 media.

This tape_inv option is available in version 4.1.7 and later of OSVault.

Future releases of tape_inv will allow you to run the command when other tape operations are active and will not require you to specify the device name for the first tape drive.

No comments: