Last updated on January 16, 2012 by Dan Nanni
When you need to create multiple VMs with vanilla Linux installed, cloning an existing VM saves you time with installation and configuration of new VMs. If you are using VMware Workstation, VM cloning process is streamlined with a built-in Clone Virtual Machine Wizard. However, if you are using VMware Server, it does not have such functionality, and you need to clone VMs manually. In order to clone a VM in VMware Server 2.0, you can follow these step-by-step instructions.
First, make a copy of a disk image of an existing VM (e.g., old_vm
).
$ vmware-vdiskmanager -r old_vm.vmdk -t 2 temp_vm.vmdk
Next, create a new VM via VMware Server web interface (using the same VM template as the existing VM), and name it new_vm
. When asked about a disk, choose "use existing disk
" and point it to the copy you made before. You'll then get directory named new_vm
with three files inside: new_vm.vmsd
, new_vm.vmx
, and new_vm.vmxf
.
Now, move the files of your new disk image (e.g., temp_vm.vmdk
) to new_vm
directory.
Rename your disk image as follows.
$ vmware-vdiskmanager -n temp_vm.vmdk new_vm.vmdk
Open new_vm.vmx
file in a text editor, and change paths to point to new location of your disk image (e.g., new_vm.vmdk
).
Power up the cloned VM.
The final step needed involves updating the network configuration inside the cloned VM, and is thus Linux-distro specific as shown below.
For CentOS/RHEL/Fedora-based VM, open up the VM console, and modify the following:
/etc/sysconfig/network
: Change hostname
/etc/udev/rules.d/70-persistent-net.rules
: Change MAC address of network interface(s) according to new_vm.vmx
specification
/etc/sysconfig/network-scripts/ifcfg-ethX
: Change hwaddr
field)
For Debian/Ubuntu-based VM, open up the VM console, and modify the following:
/etc/hostname
: Change hostname
Reboot the cloned VM again, to complete the whole process.
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 ‒ About ‒ Write for Us ‒ Feed ‒ Powered by DigitalOcean