Cloning a VM on ESX Server 3.0.1
48 Comments Published by Dan August 31st, 2007 in Technical, VMWareI’ve had time this week to get familiar with our test server environment which is a rather old Dell server running VMWare ESX Server 3.0.1. After creating a new VM and getting a base linux OS configured, I wanted to clone it for later use. I’ve used VMWare Workstation and VMWare Server before and the cloning process there is very simple–just copy. On ESX Server, there are a couple more steps required and then some other steps that are optional, but make life easier in the long run.
Here is the process I followed to perform a clone. It worked well and I was successful in getting my cloned VM running. I didn’t find a process describing exactly what I did, so I thought I’d post it (mostly so I can find it later when I forget what I did). I did find a similar process for a slightly older version and most of this post comes from that process with a few exceptions.
- 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.
Please post suggestions in the comments and I’ll respond and/or update the post.
These steps are going to come in handy as I start playing with the VMs that eventually get posted up at www.OracleVMs.com.


Pingback: Confluence: ICT
Pingback: Confluence: Valdis Pukis
Pingback: Communication
Pingback: Confluence: ICT