Hot adding a virtual disk to a virtual machine from command line interface
search cancel

Hot adding a virtual disk to a virtual machine from command line interface

book

Article ID: 309759

calendar_today

Updated On:

Products

VMware vSphere ESXi

Issue/Introduction

This article provides steps for hot adding a virtual disk to a virtual machine from the command line interface.


Environment

VMware vSphere ESXi 

Resolution

To hot add a virtual disk to a virtual machine:

  1. Connect to the host through SSH. For more information, see Using ESXi Shell in ESXi 5.x and 6.0 (2004746).
  2. 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

  3. 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.


Additional Information