I just resurrected a 10 year old offline root certificate authority that had run on VmWare Workstation and so have had opportunity to verify @Stuart's answer as correct as of QEMU version 6.2.0 (probably earlier). qemu-img convert
will indeed recombine all the files into a single .qcow2 file. But ...
It is critical that you identify and use the "top" file in the backing chain as the source file in qemu-img convert
- you cannot reliably identify the top file by VmWare's naming conventions - they vary apparently.
Use qemu-img info --backing-chain
to reveal the "top" file.
Here is a script to list the backing chains for all your .vmdk files:
for i in `ls *.vmdk`
do
echo $i
qemu-img info --backing-chain $i|grep "backing file:"
done
The file that has ALL the other .vmdk files in the backing chain is the one you want to submit to qemu-img convert
as the top file. It will then take care of combining them all into the output file. Syntax:
qemu-img convert -p[c] [-f vmdk] -O qcow2 \
[-o nocow=on] <top_file>.vmdk output.qcow2
optional arguments:
-c Compresses the output file. Slower but produces a smaller file. Desirable if the output will be copied elsewhere.
-f vmdk Specifies the type of input file but if you were successful at listing the backing chain, qemu-img is certain to figure this out on it's own.
-o nocow=on Turns off Copy on Write for the file. This is desirable for performance reasons if the target file system is already COW (like btrfs).