unix

How do I manually clone a VM in VMware ESX 3.0 and later?

Perform a clean OS shutdown of the guest OS running in the VM. Ideally, this will result in the VM being powered off.
Login to the ESX Server using SSH as the root user.
Use “vdf –h” to determine where the VMFS filesystems are mounted. In our example, this is /vmfs/volumes/AttachedSCSI
Locate the current VM image (at /vmfs/volumes/AttachedSCSI/shelob).
Run “cp –r /vmfs/volumes/AttachedSCSI/shelob /vmfs/volumes/AttachedSCSI/shelob-clone &“
Go do something else for a while to let the copy finish (at least 30 mins)
Once the copy is finished, go to the new directory (shelob-clone) and rename all the files to use the new clone name. For example, the string “shelob” will be in the filename for each file. You should rename the file so that “shelob-clone” is in the filename instead of “shelob”.
Once you’ve renamed all the files, run “file *” in this directory (shelob-clone).
Edit all files (back them up first) that are listed as “ASCII text” or “ASCII English text”. In each of those files, you may find references to the old filenames or directory names. Modify the references appropriately to use the new names.
Also edit the shelob-clone.vmx file to remove the following lines:
ethernet0.generatedAddress = “…..”
ethernet0.generatedAddressOffset = “…..”
uuid.location = “…..”
uuid.bios = “…..”
Add the following line to shelob-clone.vmx:
uuid.action = “keep”
Register the new cloned VM with ESX server by running the following command (this should all be on one line):
vmware-cmd -s register /vmfs/volumes/AttachedSCSI/shelob-clone/shelob-clone.vmx
Go to the Virtual Infrastructure client and start the new VM. If the guest OS is linux, you should expect kudzu to detect that the old Ethernet controller was removed and a new one has been added. The benefit of this detection is that it will prompt you to add network configuration information. When you’re prompted, you can choose the appropriate IP configuration/address for this new guest VM. Note that you should make sure that your original VM and the new VM have different IP addresses if you intend to have them running at the same time.

Click to comment

Leave a Reply

Your email address will not be published. Required fields are marked *

To Top