This post will show you how you can create a clone (a backup copy is probably more accurate language) of a running virtual machine hard disk using nothing but a Standalone ESXi host without vCenter or VCSA.
The problem you will run into if you tried to do this in a straight forward fashion is the hypervisor lock on the virtual disk file will prevent you from creating a copy or backup of the virtual hard disk (<VM_NAME>-flat.vmdk and its associated descriptor <VM_NAME>.vmdk) while the virtual machine is running.
The trick to work around this constraint is to create a snapshot of the running VM which releases the lock on the -flat.vmdk file and transfers the lock to the new snapshot disk file.
In my example, the snapshot data file is named win2025dc1-000001-sesparse.vmdk and the descriptor is win2025dc1-000001.vmdk.
VM Directory Prior to Snapshot:
-rw-r--r-- 1 root root 144.0K Sep 1 09:14 vmware.log
-rw------- 1 root root 81.0M Sep 1 09:09 vmx-win2025dc1-7791058fa68278eaed9ef6a11d63a4500273a3b5-1.vswp
-rw------- 1 root root 81.0M Aug 25 08:14 vmx-win2025dc1-7791058fa68278eaed9ef6a11d63a4500273a3b5-2.vswp
-rw-r--r-- 1 root root 52 Jul 25 02:57 win2025dc1-8bd91f60.hlog
-rw------- 1 root root 2.0G Sep 1 09:09 win2025dc1-8bd91f60.vswp
-rw------- 1 root root 90.0G Sep 1 09:14 win2025dc1-flat.vmdk
-rw------- 1 root root 264.5K Sep 1 09:09 win2025dc1.nvram
-rw------- 1 root root 505 Sep 1 09:09 win2025dc1.vmdk
-rw-r--r-- 1 root root 0 Jul 12 06:49 win2025dc1.vmsd
-rwxr-xr-x 1 root root 3.7K Sep 1 09:09 win2025dc1.vmx
-rw------- 1 root root 0 Sep 1 09:09 win2025dc1.vmx.lck
-rw------- 1 root root 4.0K Aug 24 14:32 win2025dc1.vmxf
-rwxr-xr-x 1 root root 3.6K Sep 1 09:09 win2025dc1.vmx~
VM Directory After Snapshot:
-rw-r--r-- 1 root root 156.9K Sep 1 09:17 vmware.log
-rw------- 1 root root 81.0M Sep 1 09:09 vmx-win2025dc1-7791058fa68278eaed9ef6a11d63a4500273a3b5-1.vswp
-rw------- 1 root root 81.0M Aug 25 08:14 vmx-win2025dc1-7791058fa68278eaed9ef6a11d63a4500273a3b5-2.vswp
-rw------- 1 root root 366.0M Sep 1 09:17 win2025dc1-000001-sesparse.vmdk
-rw------- 1 root root 317 Sep 1 09:17 win2025dc1-000001.vmdk
-rw-r--r-- 1 root root 52 Jul 25 02:57 win2025dc1-8bd91f60.hlog
-rw------- 1 root root 2.0G Sep 1 09:09 win2025dc1-8bd91f60.vswp
-rw------- 1 root root 2.0G Sep 1 09:17 win2025dc1-Snapshot1.vmem
-rw------- 1 root root 3.5M Sep 1 09:17 win2025dc1-Snapshot1.vmsn
-rw------- 1 root root 90.0G Sep 1 09:17 win2025dc1-flat.vmdk
-rw------- 1 root root 264.5K Sep 1 09:09 win2025dc1.nvram
-rw------- 1 root root 505 Sep 1 09:09 win2025dc1.vmdk
-rw-r--r-- 1 root root 393 Sep 1 09:17 win2025dc1.vmsd
-rwxr-xr-x 1 root root 3.7K Sep 1 09:17 win2025dc1.vmx
-rw------- 1 root root 0 Sep 1 09:09 win2025dc1.vmx.lck
-rw------- 1 root root 4.0K Aug 24 14:32 win2025dc1.vmxf
-rwxr-xr-x 1 root root 3.7K Sep 1 09:17 win2025dc1.vmx~
Depending on whether you're dealing with thin or thick provisioned virtual disks, you can either opt to do the -flat.vmdk copy with the ESXi Host Client Datastore Browser or the vmkfstools builtin utility for the most reliability and flexibility.
vmkfstools syntax:
vmkfstools -i <input virtual disk> <output virtual disk> -d <disk format>
[root@esxi70:/vmfs/vol/truncated/win2025dc1] vmkfstools -i /vmfs/volumes/5c7c8eb2-dfb3e413-3690-001fbc0f29c1/win2025dc1/win2025dc1.vmdk /vmfs/volumes/HDD8TBVMFS6-1/temp/win2025dc1.vmdk -d zeroedthick
Destination disk format: VMFS zeroedthick
Cloning disk '/vmfs/volumes/5c7c8eb2-dfb3e413-3690-001fbc0f29c1/win2025dc1/win2025dc1.vmdk'...
Clone: 100% done.
Once you've created the copy of the input virtual disk, you can either create a new virtual machine and attach the existing virtual disk, or you can copy the original virtual machine files (.vmx, .vmxf, .vmsd etc) to the new storage location where the output virtual disk resides.
If powering off the VM is possible for you at all, I would recommend going that route and either exporting the VM to OVF in the Host Client GUI, or using the vmkfstools utility.
This article is strictly aimed at people who don't have vCenter or VCSA and who don't/can't power off the VM during the virtual disk migration. I'm aware there are third party tools which can perform the same task with a fraction of the effort.
VMware Direct Download Links
VMware 8x (ESXi, vCenter, VCSA)
VMware 7x (ESXi, vCenter, VCSA)
VMware 6x (ESXi, vCenter, VCSA)
VMware Omnissa Horizon
VMware Workstation
VMware Remote Console
VMware Tools
If any of the links are broken please report it by posting a comment at the bottom of this page (login isn't required and there's no waiting period 😍).
VMKFSTOOLS Help Information Output
[root@esxi70:/] vmkfstools --help
OPTIONS FOR FILE SYSTEMS:
vmkfstools -C --createfs [vmfs5|vmfs6|vfat]
-S --setfsname fsName
-Y --unmapGranularity #[bBsSkKmMgGtT]
-O --unmapPriority <none|low|medium|high>
-Z --spanfs span-partition
-G --growfs grown-partition
deviceName
-P --queryfs -h --humanreadable
-T --upgradevmfs
vmfsPath
-y --reclaimBlocks vmfsPath [--reclaimBlocksUnit #blocks]
OPTIONS FOR VIRTUAL DISKS:
vmkfstools -c --createvirtualdisk #[bBsSkKmMgGtT]
-d --diskformat [zeroedthick
|thin
|eagerzeroedthick
]
-a --adaptertype [deprecated]
-W --objecttype [file|vsan|vvol|pmem|upit]
--policyFile <fileName>
-w --writezeros
-j --inflatedisk
-k --eagerzero
-K --punchzero
-U --deletevirtualdisk
-E --renamevirtualdisk srcDisk
-i --clonevirtualdisk srcDisk
-d --diskformat [zeroedthick
|thin
|eagerzeroedthick
|rdm:<device>|rdmp:<device>
|2gbsparse]
-W --object [file|vsan|vvol]
--policyFile <fileName>
-N --avoidnativeclone
-X --extendvirtualdisk #[bBsSkKmMgGtT]
[-d --diskformat eagerzeroedthick]
-M --migratevirtualdisk
-r --createrdm /vmfs/devices/disks/...
--sectorSize [512n|4kn]
-q --queryrdm
-z --createrdmpassthru /vmfs/devices/disks/...
-v --verbose #
-g --geometry
-x --fix [check|repair]
-e --chainConsistent
-Q --objecttype name/value pair
--uniqueblocks childDisk
--dry-run [-K]
vmfsPath
OPTIONS FOR DEVICES:
-L --lock [reserve|release|lunreset|targetreset|busreset|readkeys|readresv|
|registerkey|clearallkeys
] /vmfs/devices/disks/...
-B --breaklock /vmfs/devices/disks/...
OPTIONS FOR VMFS MODULE:
--traceConfig [0|1]
--dataTracing [0|1]
--traceSize <x> (MB)
vmkfstools -H --helpIf you have any questions/comments regarding this article, click here or scroll down below (login isn't required to post comments and there's no waiting period).