Need Another Tape Drive? Go Virtual!

The save/restore functionality that comes fully integrated with the IBM i operating system out-of-the-box is legendary, with a wide spectrum of functionality and device support there really is nothing that you cannot do with the native save/restore architecture on the platform. With respect to devices supported, the choices are many, you can save to physical tape, save to a save file, a physical RDX drive, etc., but did you know that you save/restore to/from a “virtual” tape drive?

The virtual tape drive functionality in IBM i is built upon the system’s rock-solid image catalog architecture where “volumes” are built in the IFS to emulate various types of storage like DVD storage for installation disk images, and, for tape virtualization, storage for virtual tapes where each volume in an image catalog is analogous to a discrete physical tape loaded into a physical tape drive.

Virtual tape drives have some nice advantages that you may want to look at to see if they may have a place in your environment, here are the main features that you may find interesting:

  • They are extremely fast, there is no physical tape that needs to be written to or read from, all virtual tape I/O is to/from disk so overall performance is incredible, and if you have solid-state disks the performance can go from incredible to spectacular
  • There are no physical tape cartridges that need to be handled (“handled” as in inserted, removed, or, dropped on the floor!)
  • Supports all IBM i save commands (except SAVSTG)
  • Can be used as the “source” tape device in a DUPTAP command to a “target” physical tape drive
  • Enables some creative ways to move data from one system to another by FTP’ing the image catalogs used to other systems so they can be mounted on virtual tape drives on those systems and read/duplicated

Creating a virtual tape drive is easy, and there is nothing to purchase or install, everything you need is fully baked into IBM i, just follow these easy steps…

  1. Create the virtual tape drive itself: CRTDEVTAP DEVD(TAPVRT01) RSRCNAME(*VRT)
  2. Vary-on the new virtual device: VRYCFG CFGOBJ(TAPVRT01) CFGTYPE(*DEV) STATUS(*ON)
  3. Create an image catalog that will hold the “virtual tapes” for the virtual tape drive where each catalog entry is a virtual tape: CRTIMGCLG IMGCLG(TAPVRT01) DIR(‘/tapvrt01’) TYPE(*TAP) CRTDIR(*YES)
  4. Add an image catalog entry for each virtual tape volume that you wish to have (e.g. VOL001, VOL002, etc.): ADDIMGCLGE IMGCLG(TAPVRT01) FROMFILE(*NEW) TOFILE(VOL001) IMGSIZ(10000) ALCSTG(*MIN) VOLNAM(VOL001) DENSITY(*VRT32K)
    • ALCSTG(*MIN) is highly recommended which will only consume storage as data is written to the virtual tape volume
    • DENSITY(*VRT32K) is recommended which will write data to the virtual tape with a maximum block size of 32KB which will enable the volume to be duplicated to all supported tape devices
    • IMGSIZ(10000) defines the size of the virtual tape volume in megabytes (10GB in this example)
    • It is best to have the TOFILE(xxx) and VOLNAM(xxx) parameters set to the same value (VOL001 in the above example)
  5. When you are done adding virtual tape volumes to the virtual tape image catalog, all that you have left to do is load the image catalog onto your virtual tape device: LODIMGCLG IMGCLG(TAPVRT01) DEV(TAPVRT01)

You now have a new virtual tape drive named TAPVRT01 with virtual tapes loaded into it and you can execute an INZTAP against the drive and then any save operation you wish to use just as if you were using a traditional physical tape device.  I like to manage virtual tapes for a virtual tape drive by using the WRKIMGCLGE command, entering this command in our configuration example will display the screen below: WRKIMGCLGE IMGCLG(TAPVRT01)


From this screen you can quickly & easily load/unload virtual tapes, initialize them, display them, duplicate them, etc.

There are few special handling tips that you need to be aware of in working with virtual tapes:

  • When using the INZTAP command do not use the CLEAR(*YES) parameter on the command
  • To write-protect a virtual tape in the image catalog use the CHGIMGCLGE command (for example, to write protect volume VOL001 in our exercise above): CHGIMGCLGE IMGCLG(TAPVRT01) IMGCLGIDX(1) WRTPTC(*YES)
  • After you are done with a virtual tape and you want to clear all the data off of it and return any storage consumed back to the system, it is necessary to run two commands to make that happen, in this example we want to clear volume VOL001 and return any storage it used back to the system, so we need to run these two commands in the order listed:
  • Files can automatically span multiple virtual volumes, just like physical tapes do, if you specify the VOL(*MOUNTED) parameter on the save command used the volume that is currently mounted will be used, if no volumes are mounted, the next loaded volume will be mounted automatically
  • If you specify the VOL(*MOUNTED) parameter on the save command used, a new tape volume (image catalog entry) will be automatically created when the save operation reaches the end of the currently defined image catalog tape volumes
  • Always be cognizant of how much disk space a particular save operation to a virtual tape drive will take, if you have a 300GB library to save to a virtual tape drive and your system has only 200GB of free disk space then the save to the virtual drive will fill all of the disk storage on your system and cause a critical disk storage condition

Using virtual tape devices and virtual tape media loaded into image catalogs is a great way to give you yet another way to do saves and restores on your IBM i.  Create a virtual tape device and virtual tape volumes on your system and experiment with this wonderful facility and explore how it can add value to your system’s save/restore capabilities.

More from this month:

Leave a Comment

Your email address will not be published. Required fields are marked *