A single tape drive can be owned by the VIOS and swapped between AIX logical partitions with some simple commands.
The Virtual I/O Server (VIOS) is best known for its ability to share disk and network resources without having to allocate a separate physical adapter for each client partition. A not-so-well-known ability is that it can virtualize a physical tape drive to client partitions. With PowerVM, the VIOS owns the I/O slot that holds the adapter and the tape drive. A virtual SCSI adapter (VSCSI) allows the client partition—the VM—to access the tape drive.
You can use the virtualized tape drive to restore from a backup made on a physical tape drive, or vice versa. Because the tape drive is virtualized, you can easily reassign the tape drive to a different logical partition without using Dynamic LPAR (DLPAR) to reallocate the tape drive's parent adapter and I/O slot.
The procedure for exporting a tape drive from the VIOS is quite straightforward, but let's get the T&Cs out of the way first.
The Fine Print
Physical-to-virtual mapping currently only applies to Serial-Attached SCSI (SAS) tape drives. If your tape drive is attached via a Fibre Channel adapter that’s NPIV enabled, you can use Virtual Fibre Channel adapters on your client, as explained by Chris Gibson in this tip. It's also important to realize that the tape drive isn’t shared, because it can only be used by one logical partition at a time.
The VIOS doesn't support functions to move media, so this procedure is really best suited for small environments with one-off tape requests that don't need the features and functions of a tape library.
There are some minimum requirements for the AIX and VIOS environments. The VIOS needs to be at 2.1.0.0, and it's recommended you be at least at v2.1.0.10-FP20.1. (That VIOS level came out in 2009, so hopefully your VIOS is more recent than that.) You can check your VIOS level by logging onto the VIOS as the user padmin and running ioslevel.
If you're running AIX 6.1, you'll need to be on Technology Level (TL) 03 or higher. The oslevel -s command will tell you if have the correct TL. To see the other prerequisites, check out the IBM Technote in the Learning Path.
Now, let’s move on to the technical procedure.
Assign the Tape Drive to the VIOS
You don't assign just a drive to the Virtual I/O Server; you assign the I/O slot that contains the SAS adapter that the tape drive is connected to. If you’ve assigned the slot using Dynamic LPAR (DLPAR), you might need to get the VIOS to recognize it by logging in as padmin and using the cfgdev command (this is the VIOS equivalent of the AIX command cfgmgr). Don't forget to add the I/O slot to the VIOS partition profile so that the slot, adapter, and tape drive don't go AWOL next time you shut down the VIOS and activate it again.
To view the available tape drives on the VIOS, run the following command as padmin:
name status description
rmt0 Available SAS 4mm Tape Drive
Remember, this procedure is available for SAS tape drives, such as the one listed above. It doesn't apply to SCSI tape drives. If you're still not sure if your tape drive can be used as a backing device for a virtual SCSI (VSCSI) adapter, you can list the tape drives that can be virtualized using the following command:
name status description
rmt0 Available SAS 4mm Tape Drive
Separate the VSCSI Adapter
The next step is to export this to a client so it can be accessed as a virtual tape drive. It's preferable to have a separate VSCSI host adapter rather than use a vhost that’s already being used for disk or optical devices. If you need to add a new VSCSI adapter, check out the IBM Technote “Add/Delete a VSCSI Client Adapter from IVM Client LPAR.”
Now it's time to map the tape drive to the VSCSI host (vhost) adapter using the VIOS mkvdev command:
Or, if you prefer, you can name the adapter with the -dev flag:
aix1_rmt0 Available
Once you’ve mapped the drive to the vhost adapter, you should be able to see the tape drive using the VIOS lsmap command:
Which results in the following output:
--------------- -------------------------------------------- ------------------
vhost5 U8203.E4A.0123D45-V1-C27 0x00000007
VTD aix1_rmt0
Status Available
LUN 0x8600000000000000
Backing device rmt0
Physloc U789C.001.DQDQ700-P2-D1
Because the tape drive has a virtual map, you won't be able to perform any operations directly from the VIOS to address the physical tape drive. The drive has effectively been reserved for use by the AIX client partition, which is where you can access the tape drive for backup and restoration operations.
Identify Drive on AIX
On the AIX client partition, run cfgmgr to identify the tape drive. If you can't see it, check that the VSCSI client adapter is correctly assigned on the AIX partition. Both the VSCSI adapter and the tape drive should appear on the output of the lscfg command. You can now perform backups to the tape drive on the client.
Reassigning to Another Partition
If you want to assign the tape drive to a different logical partition, you’ll need to undo the mapping. The neatest way is to remove the tape drive from the AIX logical partition, then remove the VSCSI connection on the VIOS.
First, on AIX, you can remove the tape drive using rmdev:
That lets the virtual device know it needs to be removed from the VIOS. You should use the name of the virtual target device (VTD) as the VIOS knows it. This might be the default name, such as vttape0, or the name you assigned when you built the VSCSI connection. In this example, the virtual tape drive was created using the -dev flag of the mkvdev command, so to remove it, the same name must be used:
It can then be assigned to a different VSCSI adapter (vhost) on the VIOS:
Features and Flexibility
In shared hosting environments, you might need to make a tape drive available for different partitions, and the method I’ve just outlined can be an easy way of moving the tape drive around.
Learning Path
Configuring Virtual Tape on Virtual I/O Server
PowerVM Migration from Physical to Virtual Storage (see section 3.4.3, SAS-Attached Tape Devices)
Add/Delete a VSCSI Client Adapter from IVM Client LPAR
IBM Virtual I/O Server Support for Power Systems
Creating a Virtual Target Device (VTD) on the VIOS to map to disks, tapes or optical devices
Download AIX User-Related Commands (Infographic) today! This quick guide highlights differences between user administration commands on AIX and other UNIX-derived operating systems.