LuckyT
Contributor
Contributor

How to remove disk from virtual machine?

Hi All,

           I have added disk to Virtual Machine using "Add Disk" workflow. but i couldn't find workflow to remove the added disk. Can anyone help me to figure out?

Thanks in advance.

0 Kudos
7 Replies
Ethan44
Enthusiast
Enthusiast

Hi

Welcome to the communities.

If you you wan to remove completely on setting you will find number of /p>

Hard drive attached to this vm , so make vm offline & remove HDD .   

"I never look back, it distracts me from the now"
0 Kudos
LuckyT
Contributor
Contributor

Thanks for the response.

I want to remove one disk out of 3 disk attached to VM. Can you share script if you have? or share API?

I tried looking into API guide but i could not find any method to remove particular virtual disk attached to Virtual Machine.

Thanks again.

0 Kudos
OscarDavey
Hot Shot
Hot Shot

Hello,

At first you need to power off Virtual machine

and then remove virtual disk.

Hope will help.

0 Kudos
iiliev
VMware Employee
VMware Employee

Take a look at action 'com.vmware.library.vc.vm.spec.config.device.createVirtualDiskFlatVer2ConfigSpec()', used in 'Add Disk' workflow.

Within it, we prepare an instance of 'VcVirtualDeviceConfigSpec' class. In 'Add Disk' workflow, operation and fileOperation properties are initialized to add/create. According to the API docs listed below, there are also values for remove/destroy operations.

https://www.vmware.com/support/orchestrator/doc/vco_vsphere55_api/html/VcVirtualDeviceConfigSpecFile...

https://www.vmware.com/support/orchestrator/doc/vco_vsphere55_api/html/VcVirtualDeviceConfigSpecOper...

Should be a good starting point for experiments.

0 Kudos
LuckyT
Contributor
Contributor

Thanks IIian, i already tried that. I'm able to remove virtual Hard disk from VM, but i'm not able to delete .vmdk file, which resides in datastore. I tried with VcVirtualDeviceConfigSpecFileOperation object but no luck.

0 Kudos
ChristianWehner
VMware Employee
VMware Employee

Maybe that's the time you want to try VMware Onyx?! Smiley Wink       Onyx – VMware Labs

Connect to your vCenter using Onyx and you can record what happens if you manually delete a Disk from VM. Here tje project page: VMware Project Onyx

Regards,

Chris

0 Kudos
kgund
Contributor
Contributor

Could you please share the script to remove virtual hard disk from VM

0 Kudos