Adding tape Library/Drive to VM running over ESX/ESXi 4.

I have been asked lately if NPIV could be used to attach a tape library to a VM, & as attaching tape libraries to a VM has never been well documented. I have decided to write a small post about it. I don’t want to be a smart A**, but I will start by asking why would you want to attach a tape to a VM? Why not utilize VMware Storage API for backup & move on with it. As any method that can be utilized to connect a tape Drive/ Tape library to a VM running on ESX will compromise on many feature & introduce many restrictions to your environment. That have been said let’s see what options are available & what option is just confusing people.

– As the question was about NPIV & most people are mostly confused by it, I will start by saying NPIV will not help you add a tape library to a VM. NPIV is mainly useful when attaching LUNs & dealing with storage devices. It does not deal with tape libraries.

Ok, now that we had got NPIV confusion out of the way we still left with the question is it possible to attach a tape Library/Tape drive to a VM running on ESX/ESXi? The answer is yes, and there is actually two methods in going about it:

1- Adding a tape Library/Tape drive utilizing VMDirectPath (Make sure your hardware & software setup meet VMDirectPath before you proceed with this method)

Note: The below steps has been obtained from VMware KB Article: 1010789

About VMDirectPath I/O pass-through devices

You can connect up to two passthrough devices to a virtual machine. When selecting the devices, keep in mind these restrictions:

  • Devices cannot be plugged in after a PCI Bridge.
  • You cannot have two devices in two different contexts (for example, one used by VMkernel and one in pass-through) using the same PCI slot. For example, the dual head NIC is dedicated to the VMkernel OR is available for pass-through. If you select one, the other is automatically selected as well. A dialog informs you why this occurred.

Configuring pass-through devices

To configure pass-through devices on an ESX host:

  1. Select an ESX host from the Inventory panel of VMware Infrastructure (VI) Client.
  2. On the Configuration tab, click Advanced Settings. The Pass-through Configuration page lists all available pass-through devices.Note: A green icon indicates that a device is enabled and active. An orange icon indicates that the state of the device has changed and the host must be rebooted before the device can be used.
  3. Click Edit.
  4. Select the devices and click OK.Note: If you have a chipset with VT-d, when you click Advanced Settings in VI Client, you can select what devices are dedicated to the VMDirectPath I/O.
  5. When the devices are selected, they are marked with an orange icon. Reboot for the change to take effect. After rebooting, the devices are marked with a green icon and are enabled.Note: The configuration changes are saved in the /etc/vmware/esx.conf file. The parent PCI bridge, and if two devices are under the same PCI bridge, only one entry is recorded.The PCI slot number where the device was connected is 00:0b:0. It is recorded as:/device/000:11.0/owner = “passthru”Note: 0b is 11 in decimal.

To configure a PCI device on a virtual machine:

  1. From the Inventory in VI Client, right-click the virtual machine and choose Edit Settings.
  2. Click the Hardware tab.
  3. Click Add.
  4. Choose the PCI Device.
  5. Click Next.

    Note:
    When the device is assigned, the virtual machine must have a memory reservation for the full configured memory size.

2- Adding a Tape Library/Drive as a SCSI device to the VM running on ESX/ESXi.

The below instruction are coming from VMware KB Article: 1016407.

To configure a tape device with a virtual machine in ESX 4.0 and ESX 4.1:

  1. Consult your backup hardware and software vendor to ensure that your tape device and backup software are supported to work with VMware ESX 4.0 and ESX 4.1. For more information, see the Additional Information section in this article.
  2. Configure the tape device and controller according to the hardware vendor’s guidelines.
  3. Connect VMware vSphere Client to the VMware vCenter Server or VMware ESX host.
  4. Click on the VMware ESX host which has the hardware connected.
  5. Click Configuration tab > Storage Adapters.
  6. On the Storage Adapters list, identify the controller which has the tape attached.
  7. Under Details, record the Runtime Name of the tape device. For example, vmhba2:C0:T1:L0.
  8. Select the virtual machine that will use the tape device, and click Summary tab > Edit Settings….
  9. Click the Hardware tab > Add….
  10. Select SCSI Device from the list of device types and click Next.
  11. Select the appropriate device from the SCSI Device drop down list.
  12. Select the Virtual Device Node which matches the Adapter and Target of the Runtime Name of the device, as recorded in step 6. The Virtual Device Nodes are denoted as <Bus>:<Target>. For example, the Runtime Name vmhba2:C0:T1:L0 corresponds with a Virtual Device Node of (1:1), (2:1), or (3:1).Note: For more information about the Runtime Name, see Identifying disks when working with VMware ESX (1014953).Warning: For clarification, (0:1) is also available for configuration. However this bus is usually already populated by a virtual disk in a typical virtual machine setup. As tape operations by nature are quite disruptive for devices on the same bus, to avoid interruption, ensure the tape devices’ target IDs are on a separate bus from the other virtual machine disks attached to the virtual machine. For example, bus (0:x) can have several virtual machine disks, while bus (1:x) has the tape pass-through device(s).
  13. Proceed to install and configure the backup software according to the software vendor’s guidelines.

Additional Information

The functionality of the tape library and the backup software in conjunction with VMware ESX is partner-supported. VMware assumes that the third party vendor has completed necessary validation to support this configuration in a production environment.
In the event that a problem is found, VMware recommends opening a support request directly with the third-party or partner vendor’s support organization. VMware collaborates with other vendors via Technical Support Alliance Network (TSANet) or Cooperative Support Agreement (CSA).
For more information regarding third party vendor support, see Third Party Hardware and Software Support Policy.

Note:

  • As of vSphere 4.0, ESX only supports connectivity to parallel SCSI tape libraries.
  • VMware only supports the attaching of Parallel SCSI based tape Devices to an Adaptec SCSI Controller, see Page 20 of the Virtual Machine Backup Guide for further information

Now, you ask which method shall I use. If your hardware & software configuration is supported by VMDirectPath, then I would check with the tape library vendor on which method to use, else you are stuck with the attaching directly to SCSI method. Remember the support statement here highly depend on your tape library vendor, so consult your vendor before implementing it.

At the end, I would still say if you can avoid attaching a tape library to a virtual VM then by all mean just avoid it as it will make your life much easier beside there is many other good methods for backing up VMs that does not require it (Ex: vStorage API)

I hope this help some one, & please leave your ideas and comment in the comments area below.

Comments

  1. Rafat Odeh says:

    Dear Eiad thank you for the amazing information actually this was in my mind for long time and now you open the topic and clear many thing and make it easy to me because what I done to solve this issue is keeping the backup server physical… so now I can convert it and have it virtual while my ESXi server support pass-through 🙂
    Thank you 🙂

  2. Hi Rafat,

    Please don’t miss the point in there. I am not recommending to do this at all, but many people has requested how to do it & only for that I posted it.

    For now, I would really still recommend your backup server to be a physical machine. It will make your life much easier, as well due to the nature of the backup server it will act much better as a physical machine.

    Enjoy,
    Eiad

  3. Martijn Hoogenbosch says:

    Hi Eiad,

    I’m running my backup machine virtual and was experiencing much problems with the tape. You describe two methods, the second i’m using now. You describe the device id i have to use. When i check ESXi i can see the id of the tape streamer, this is c0t0d0, but 0:0 is in use by my harddisk (tape streamer is on its own scsi card). So i used 1:0 instead, this seems to work fine (0:1 or 0:2 doesn’t seem to work at all).

    Which is the better method, 1 or 2? Because when i’m using the first method i can passthrough the scsi card where the tape streamer is attached to. But when i connect that to the VM the steamer doens’t show up. I can see the scsi card and install the correct drivers for it, but the streamer doesn’t show in the VM, not even an unknown device.

    Any thoughts about this?

  4. Hi Martijn,

    I hate to start with a nasty statement, but I believe the best option so far is to have your backup server as physical if you need to utilize tapes. The other lovely note would be tapes are the backup method of the past, you might want to look into disk backup or Virtual Tape Library which should work much better in a virtual environment.

    Ok, after getting my nasty thought out. Unfortunately, there is no easy answer to which method is better it will end up more of what the preferred or supported method of your hardware & backup software vendors (I usually prefer VMDirectPath I/O pass-through devices if that work as its more flexible, but more people seems to succeed using the second method!!). Though different vendor seems to support different combinations. If I were you, I would check with your tape library & backup software provider for recommendation.

    Regards,
    Eiad

  5. Anonymous says:

    Hi Eiad,

    I am trying to configure my backup devices using method 2. My ESX can detect the drive as vmhba2:C0:T6:L0 and the library as vmhba2:C0:T6:L1. I am only able to add the drive to the VM as 0:6. How am I supposed to present the library to the VM as well? I have tried various SCSI targets but to no avail.

  6. I have the same problem too. The library sees the drive has a LUN ID 1 but the VM is picking as LUN 0. How do the force the VM to see LUN 1?

  7. Hi anyone knows if with SAS tape libraries in ESXi 5 the procedure it´s the same?
    Thanks 😉

  8. Hi,

    David, I’m stucked in same problem that you experiencing.But all that I’ve read about using Tape with SAS is not good.

    Anyone here could help us?

    Thanks!

  9. David and Fernando,
    I myself currently have this problem. I have a PE 2950 (running vsphere 5) hooked to a lto4 sas drive that will not work except to inventory a tape.
    I have found these articles but do not supply to much information except to upgrade your server.
    http://en.community.dell.com/support-forums/servers/f/956/t/19366786.aspx
    http://communities.vmware.com/message/1618597

    Please whatever you find I would be very interested in the information myself. We are getting ready to pull this drive and potentially test it on a r710.

  10. Hi JLawson,

    We are currently encountering this issue too. Neither methods 1 or 2 appear to work in vSphere 5. Our issue is that the tape drive goes offline as soon as the tape backup process starts.

    Is there anyone out there at all that had managed to get a SAS tape drive working while connected to VM running in vSphere 5?

    Thanks,
    CK

  11. Hi Eiad,

    Thanks for the useful article, it’s very informative

    We have a VMware environment setup on Cisco UCS. Currently Netbackup is running os a physical server where in a Tape library is attached (scsi connected).
    If backup server converted as VM, how to attach and bring in scsi tape library into UCS?

  12. I have also had this issue both with ESXI4 and ESXI5.
    I have managed to get the tape drive working with an LSI SCSI card.
    You need to open the drive properties and go to the configuration of the drive. By default only the write single block mode and the Write SCSI pass-through mode are enabled.
    Enable the Read single block mode and the Read SCSI pass-through mode.
    Once this is done the backups will work.

Speak Your Mind

*