Wednesday, June 9, 2010

Removing a disk from a powered on VM in VMware

Here is my procedure for removing a disk from a powered on VM on VMware 3.5. The procedure was tested on a Windows 2003 SP2 32-bit VM but should be applicable to other operating systems. This is unsupported, but I have not encountered any problems.

  1. Remove drive letter/mount point in Windows Disk Manager
  2. Right click on disk in device manager and choose uninstall (if you skip this step the plug and play manager will complain about unexpected removal)
  3. Connect to host using ssh/putty
  4. Get VMID with vimsh -ne "vmsvc/getallvms"
  5. Get SCSI Controller Number and Disk from properties of disk in VC
  6. vimsh -ne "vmsvc/device.diskremove vmid scsiControllerNumber scsiUnitNumber deleteFile"
Example:

vimsh -ne "vmsvc/device.diskremove 9999 scsi0 4 n"

1 comment:

  1. Hi Benj,

    there is one of your old posts talking about OSP tools updates. Did you manage to get this working with SLES?

    Thanks,

    Chris

    ReplyDelete