How to Attach Local Tape Device to VMware ESX Host
Of interest to the small and midsize business market is the use of a tape device (drive or library) attached to a VMware ESX host. This would allow a VM to access the tape device as well as the service console. However, it is important to make sure you pick which one you are going to use, as both are NOT possible simultaneously.
Here are the steps to keep in mind when attaching a local tape device to a VMware ESX host:
1. If you have other hardware you can use to be a backup server, it is strongly urged that you use that method.
2. Pick an appropriate SCSI card for the VMware ESX host. Currently, only Adaptec SCSI cards are fully supported, yet some LSILogic SCSI cards will also work. Note that a RAID card will not work. It must be a SCSI host bus adapter (HBA).
3. Place the card within the system and connect all the cables. This will require you to shut down an already running VMware ESX host.
4. Power on the VMware ESX host. The SCSI (HBA) will automatically be recognized if the HBA is also on the VMware Hardware Compatibility List (HCL), which is updated regularly. Visit this site to see the VMware HCL:
5. Now choose: do you want to use the service console or a virtual machine? There is no real performance difference between the two. However, please note that most people will tell you this is not recommended. It is not, but using a locally attached tape device is better than using no other form of backup.
1. In order to control the tape drive and robot if you are using a tape changer, you will need to install the mt-st and mtx tools from this site:
2. Determine the tape device to use:
Host: scsi1 Channel: 00 Id: 01 Lun: 00
Vendor: HP Model: C7200 Rev: 162D
Type: Medium Changer
Host: scsi1 Channel: 00 Id: 02 Lun: 00
Vendor: QUANTUM Model: SuperDLT1 Rev: 4949
3. The ID is the SCSI ID used for the device in question. The first is the tape changer, and the second is a tape drive. Determine which SC Linux device is used for the tape devices:
dmesg | grep sg
Attached scsi generic sg1 at scsi1, channel 0, id 1, lun 0, type 0
Attached scsi generic sg2 at scsi1, channel 0, id 2, lun 0, type 1
4. The above implies that /dev/sg1 is the tape changer, and /dev/sg2 is the tape drive.
5. Generally, you will use commands like the following to write to the tape. The first will rewind the tape, and the second will record the contents of /etc to tape:
mt /dev/sg2 rewind
tar -cvf /dev/sg2 /etc
6. To back up a VM, however, you will need to first employ vcbMounter to make a copy of the VM using snapshots to a safe location. So, something like this would work, which would back up a VM named VMName to /tmp/VMName, and then place the contents of /tmp/VMName onto the tape device:
vcbMounter -a name:VMName -r /tmp/VMName
tar -cvf /dev/sg2 /tmp/VMName
From a VM
1. The main thing to be concerned about when you assign the tape devices to a VM is make sure you use the same SCSI ID as the tape devices themselves. This will help with some internal management within the vmkernel.
2. Using the VMware Infrastructure Client, go to the Settings for the VM in question.
3. Add Hardware, then select the SCSI Device option.
4. Select the SCSI Devices listed, and choose a virtual device node. This is the SCSI ID of the device to add; be sure the last number matches the ID of the device.
5. Some robots do not appear. In this case, you will need to modify the configuration file by hand. Copy the original lines for the tape device and make the appropriate substitutions for SCSI IDs in use. Finally, access the tape devices per normal Guest Operating System methods.
Virtualization expert Edward Haletky is the author of "VMware ESX Server in the Enterprise: Planning and Securing Virtualization Servers," Pearson Education (2007).
Haletky recently left Hewlett-Packard, where he worked in the Virtualization, Linux and High-Performance Technical Computing teams.
Haletky owns AstroArch Consulting, which provides virtualization, security, and network consulting and development. He is also a champion and moderator for the VMware discussion forums, providing answers to security and configuration questions. He can be reached at firstname.lastname@example.org.