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".
Rename all alice.* files (including alice.vmx) in "alice_clone" directory to corresponding alice_clone.* files.
$ 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:
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.
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!
Subscribe to Xmodulo
Do you want to receive Linux FAQs, detailed tutorials and tips published at Xmodulo? Enter your email address below, and we will deliver our Linux posts straight to your email box, for free. Delivery powered by Google Feedburner.
Did you find this tutorial helpful? Then please be generous and support Xmodulo!
Latest posts by Dan Nanni (see all)
- How to back up a WordPress website to remote cloud storage from the Linux command line - November 24, 2015
- How to access Dropbox from the command line in Linux - November 22, 2015
- How to send email notifications using Gmail SMTP server on Linux - November 9, 2015