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 ESX 4.1.x
VMware ESXi 4.0.x Installable
VMware ESXi 3.5.x Installable
VMware vSphere ESXi 6.5
VMware vSphere ESXi 6.0
VMware ESXi 4.0.x Embedded
VMware ESXi 4.1.x Embedded
VMware vSphere ESXi 5.0
VMware ESX Server 3.5.x
VMware ESXi 4.1.x Installable
VMware vSphere ESXi 5.5
VMware vSphere ESXi 5.1
VMware ESX 4.0.x
VMware ESXi 3.5.x Embedded

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



Using ESXi Shell in ESXi 5.x and 6.x
コマンド ライン インターフェイスから仮想マシンに仮想ディスクのホット アドを実行する