How to clone or copy VMware Player VM

Last updated on November 12, 2020 by Dan Nanni

In some cases you may need to create vanilla Linux virtual machines (VMs) from scratch many times. In other times you may want to duplicate particular system settings of one VM to multiple other VMs. Whatever the reason may be, being able to clone or copy an existing VM turns out to be extremely useful. If you have a VM running on VMware Player, it's easy to make a clone of the VM. The following guide has been tested with VMware Player 5.

First, power off the VM you would like to clone. Then make a copy of the directory where the existing VM's .vmx file is stored. I assume that the existing VM's directory is vmware/alice. I copy that directory as vmware/alice_clone.

$ cp -r vmware/alice  vmware/alice_clone

Rename all alice.* files (including alice.vmx) in alice_clone directory to corresponding alice_clone.* files.

$ cd vmware/alice_clone
$ rename 's/^alice/alice_clone/' * 

Edit alice_clone.vmx and alice_clone.vmxf in a text editor, and replace all occurrences of alice in the files with alice_clone. The following command-line will take care of this editing automatically:

$ sed -i 's/alice/alice_clone/g' alice_clone.vmx alice_clone.vmxf

Now open alice_clone.vmx on VMware Player, and start the cloned VM.

When the cloned VM is about to start, VMware Player will prompt you with the following message:

Choose I copied it, and then proceed.

Once told that you copied your VM, VMware is smart enough to regenerate any information which needs to be unique across different VMs (such as MAC address of the cloned VM, or VM UUID). After having started the cloned VM successfully, you will notice that VMware Player has updated alice_clone.vmx as follows.

$ diff alice/alice.vmx alice_clone/alice_clone.vmx
66c66
 ethernet0.generatedAddress = "00:0C:29:72:33:19"
68c68
 ethernet1.generatedAddress = "00:0C:29:72:33:23"
75,77c75,77
< uuid.location = "56 4d 36 a3 43 16 0f 4f-78 ef 23 ad 9c 68 24 9e"
 uuid.location = "56 4d 83 7a 5e 2c 7f 0a-df c7 a7 2a 04 72 33 19"
> uuid.bios = "56 4d 83 7a 5e 2c 7f 0a-df c7 a7 2a 04 72 33 19"

After starting the cloned VM, don't forget to change its hostname, as the cloned VM has the same hostname as the old VM!

Support Xmodulo

This website is made possible by minimal ads and your gracious donation via PayPal or credit card

Please note that this article is published by Xmodulo.com under a Creative Commons Attribution-ShareAlike 3.0 Unported License. If you would like to use the whole or any part of this article, you need to cite this web page at Xmodulo.com as the original source.

Xmodulo © 2021 ‒ AboutWrite for UsFeed ‒ Powered by DigitalOcean