I have a test setup that uses local RDM disks. I would like to script the addition and removal of the disks from a running VM. I can add the disks but haven't found a command line removal option. I can do it using vcenter or a vsphere client. I figure there has to be an underlying command for the GUI removal action. Anyone have an idea on how to do this? I looked at this kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=2004605 KB article but since the RDM is active the command line process fails.
You can't remove RDM from PowerOn VM because, a locking mechanism is created and ensures that no two virtual machines can access the same disk and perform I/O at same time.
To remove the hard disk / RDM from a powered on virtual machine, power off the virtual Machine and then remove the hard disk / RDM.
You can remove the RDM via Vcenter while a VM is running. I figure if you can do it in Vcenter there must be a way to do it via the commandline.
