Run this command to get the VMID of the virtual machine you want to add the disk to:
Earlier to ESXi version 5 use: vmware-vim-cmd vmsvc/getallvms From ESXi version 5 use: vim-cmd vmsvc/getallvms
Run this command to hot add a disk to the virtual machine:
Earlier to ESXi version 5 use: vmware-vim-cmd vmsvc/device.diskaddexisting vmid /vmfs/volumes/path to disk.vmdk 0 1 From ESXi version 5 use: vim-cmd vmsvc/device.diskaddexisting vmid /vmfs/volumes/path to disk.vmdk 0 1
The 0 at the end represents the SCSI controller you want to add the disk to and the 1 represents the SCSI target number, so if you already have a SCSI0:0 disk, add the next disk as SCSI0:1 (0 1).
Note:Make sure you use an absolute path when specifying the VMDK. For ESXi, use the vim-cmd command.
Note: You cannot use these commands to add RDMs because vim-cmd does not support it.