vohra
Contributor
Contributor

Is it possible to write a managed virtual disk which is not associated to a VM?

My scenario is that I want to attach a virtual disk to a running virtual machine. The problem

is that as soon as I attach a blank disk to a running virtual machine its locked by the virtual machine

and I cannot restore/write my data to it as I get file locked error. Further if I remove (and do not destroy) the virtual

disk from VM then the virtual disk open fails with file not found error. So the only way I could restore/write data was by powering

the machine down which amounts to considerable downtime for a large virtual disk. It seems that the vmxSpec connection parameter

in the VixDiskLib_ConnectEx is imperative and is used to make VI calls internally.

Any ideas in this regard will be appreciated.

Thanks.

0 Kudos
3 Replies
lamw
Community Manager
Community Manager

You need to either power down the VM or create a snapshot, in which the original base disk will then go into R/O mode and all changes will go to delta disks. There's no way around it, unless you unmap the VMDK from the VM all together. When a VM is powered on, there is a VMFS lock on these disks.

=========================================================================

William Lam

VMware vExpert 2009

VMware ESX/ESXi scripts and resources at:

Twitter: @lamw

VMware Code Central - Scripts/Sample code for Developers and Administrators

VMware Developer Community

If you find this information useful, please award points for "correct" or "helpful".

0 Kudos
vohra
Contributor
Contributor

Hi William

Thanks a lot for replying. I have taken the disk down from VM (completely unmapped) using Reconfigure Task of VM I have removed the disk from VM but have not destroyed it. But still I cannot write to this disk via VDDK as it seems the vmxSpec parameter is needed for VixDiskLib_ConnectEx and since the disk is no longer

related to the VM when VI calls are made internally by VDDK on disk open/write I get File not found errors. Is there a way to make this work because

the snapshot approach does not work either in this as I need write access to disk.

vohra

0 Kudos
admin
Immortal
Immortal

Hi Vohra,

Connecting to an ESX host and writing to a disk that is not attached to a VM is not recommended. You need the root credentials of ESX host to make this work and it is often not practical do

-Sudarsan

0 Kudos