CLI Command to add a SCSI device to a VM??

I am having problems adding a SCSI tape library to one of my VMs thru VC. Can some one pls tell me if there is a Service Concole command to add a SCSI device (tape librery in my case) to one of my VMs on this host. I played around a bit with esxcfg-vmhabadevs, but had no luck.

An early response would be greatly appreciated as I have to add this device to my back up server which will run back ups in abt couple of hrs now.


0 Kudos
1 Reply
Community Manager
Community Manager

If you're manually going to the VM properties and adding a SCSI device, you might be able to automate this but I assume you need to shutdown your VM right?

You can take a look at vimsh and specifically these two commands if they're available, I don't have a 3.0 box to test and verify but there have been some newly introduced functionality in vimsh when ESX went to 3.5.

On ESX 3.5+ there is a new vimsh wrapper called vmware-vim-cmd but before that, there is just vimsh which requires a few flags to execute on the CLI (for more information you can go to: http://engineering.ucsb.edu/~duonglt/vmware/#vmware_vimsh)

On 3.5, the following commands may be helpful:

[root@himalaya root]# vmware-vim-cmd vmsvc/device.getdevices
Insufficient arguments.
Usage: device.getdevices vmid

Retrieves and displays the virtual devices for the vm.

[root@himalaya root]# vmware-vim-cmd vmsvc/device.connection
Insufficient arguments.
Usage: device.connection vmid deviceKey connect

Connect/Disconnect the virtual device specified

What you can do is manually connect the SCSI device and use the first command to see what the Id for that virtual device would be and then see if you can manually attach to the VM in question.

Remember, with 3.0 you'll need to use vimsh -n -e <command>

Good Luck


William Lam

VMware vExpert 2009

VMware ESX/ESXi scripts and resources at:

0 Kudos