I have the the task of automating the creation of test beds for our product testing. This means creating up to 128 virtual machines per host, and then removing them when done. Google research shows this to be relatively easy. I just need to create a basic .vmx file, and the appropriate .vmdk file (Linux, Windows, etc.), and then copy/rename the .vmx to the new VM directory on the datastore. Using vmkfstools I just clone the .vmdk to the new datastore location with its new name.
This will all be done via a Python program and a vMA on each ESXi host.
What could be simplier? Well, nothing ever works like the documentation says. The problem is the VM I want to use as my master VM to copy/clone has two .vmdk files. One is a few hundred bytes, and the other is large, as expected.
551 May 23 16:11 linux_host2_vm13.vmdk
5368709120 May 23 16:11 linux_host2_vm13-flat.vmdk
What the heck!!!!
No where can I find any info on why there are two .vmdk files, or if both are needed.
Why are there two .vmdk files?
Do I need to clone both files?
Any help is appreciated. Thank you.
The two represent the same disk and both are needed - the smaller of the two files contains meta data about the virtual disk - the larger file contains the actual data of the disk ans is named -flat.vmdk
For vmkfstools you only need to specify the descriptor .vmdk file (the small text file). The command will automatically clone both, the descriptor as well as the data (flat) .vmdk file.
Sample: vmkfstools -i source.vmdk target.vmdk