This will explain how to clone a single dependent virtual disk (VMDK), such as an 80GB OS disk, from a running virtual machine on VMware ESXi which has a complex configuration (e.g., dozens of disks, some independent, and large total storage). Direct file copy attempts fail due to the disk being locked by the running ESXi host.
The issue is seen when attempting to clone a disk from a running VM to avoid downtime for the original machine.
VMware vSphere ESXi 8.x
VMware vCenter Server 8.x
The ESXi hypervisor maintains a file lock on the VMDK files of a running virtual machine to ensure data consistency. This prevents unauthorized modification or copying of the files while the VM is actively writing to them. A full VM clone is not desired due to the size and complexity of the VM, necessitating an individual disk cloning method.
To clone a single dependent disk from a running VM, you must use a VM snapshot to release the lock and then utilize vmkfstools for the disk copy and conversion.
Prepare the Destination: Create a new, empty virtual machine container (VM, but do not add any hard disks) on the destination datastore.
Create a Snapshot on the Source VM: In the vSphere Client, take a snapshot of the original VM. This is required to release the base disk's lock and redirect new writes to a delta file.
Establish Access: SSH into an ESXi host that has access to both the source VM's datastore and the destination VM's datastore.
Locate the Disk: Navigate to the source VM's folder to find the target OS disk VMDK (e.g., /vmfs/volumes/datastore-name/VM_NAME/VM_NAME.vmdk).
Clone the Disk: Use vmkfstools -i to clone the disk to the destination VM's folder. The example below clones the disk and converts it to a thin-provisioned format at the destination (change -d thin to -d eagerzeroedthick or omit for the same format as the source, if desired):
vmkfstools -i /vmfs/volumes/datastore-example/vm-example/vm-example.vmdk /vmfs/volumes/datastore-example/new-vm-example/new-vm-example/vm-example.vmdk -d thin
Attach the Disk: Edit the settings of the empty VM container you created in Step 1. Add a new existing hard disk and point it to the newly copied VMDK file in the destination folder.
Remove Snapshot: Once you have validated that the new cloned VM and disk are functional, delete the snapshot from the original source VM to avoid performance degradation.
Crash Consistency: The resulting cloned OS disk will be a crash-consistent copy, meaning it will boot up as if the machine was suddenly powered off and then powered back on.
Network Collision Precaution: Do not power on the cloned VM if it is connected to the same network as the original VM until its network configuration (e.g., IP address, MAC address) has been changed to prevent IP conflicts.