30

I have imported a VM into an ESXi server using the VMware "Converter stand alone utility". However, this process is a little tedious. Since I eventually want several copies of this VM (or, to be more accurate, several more-or-less identical instances of this VM) to be running at the same time, is there a way to clone the already imported VM? Or do I have to re-import for each instance I want?

2
  • 1
    Update: I have a 12 GB VM, importing to the ESXi server. Doing a straight import: 15 minutes. Using the Converter Stand Alone to clone from the ESXi server back to itself: 1 hour 15 minutes. Jun 2, 2009 at 15:16
  • 1
    Copying with cp, as per below: ran for about 15 minutes, but I couldn't get the resulting VM to start properly. Jun 2, 2009 at 16:53

9 Answers 9

38

No need to use the converter to clone a VM.

Simply browse to the datastore:

  • Click on the host > Configuration tab
  • Select Hardware > Storage to display the datastores
  • Right-click on the datastore with the VM you want to clone > Browse Datastore
  • Create a new folder in the store
  • Right click on the VM folder and select Copy (must be done in the right pane of the Datastore Browser)
  • Paste the VM to a new sub folder (otherwise the VM will overwrite itself)
  • Once copied, rename and move the folder if desired
  • Select the .vmx file within the cloned VM and select 'Add to Inventory'
4
  • 1
    I tried this method out and, while it was a successful and interesting evolution, it turned out to be at least 2x slower than just using the standalone converter on a powered off VM. I also found it to be slightly fiddly, taking more clicks/typing than using the "copy as new..." functionality in converter. I am using an NFS datastore served by Nexenta and it's bandwidth constrained
    – JGurtz
    Aug 3, 2011 at 12:32
  • Does this method allow you to copy while the vm is powered on?
    – Bretticus
    Aug 17, 2011 at 20:13
  • Perhaps not. I just tried copying a running VM folder from the HDD store to my NFS store and got several errors. I suppose I better wait until I can take the vm down.
    – Bretticus
    Aug 17, 2011 at 21:02
  • if you do this, wouldn't the vmx still reference the disk in the other folder? Mar 30, 2020 at 8:17
18

Actually it's easier to just goto the host machine in VIC under summary tab and browse the datastore. Then create a folder for the new vm, copy the vmdk file from your source vm by copy and paste within the datastore browser and then create a custom VM for the new vmdk file. Make sure your VM and folder names match and it takes 1/10th of the time to do.

Example for me was:

7gig VM:

  • Converter: 13mins
  • Direct: 3mins
  • Copy via Datastore browser: 1min

I made copies of 17 VM's in Under 20 mins which saved a ton of time from converter.

0
6

[Editing my own answer]

Summary:

  • the Converter took me about 15 minutes to run from WS6 to ESXi
  • the Converter took about 45 minutes to run from ESXi to itself
  • logging in with a command prompt and then copying as per the "unsupported" instructions worked, but took about 20 minutes to copy the VM, and I was unable to correctly start the result

My conclusion: just use the Converter repeatedly.

Thanks all for the ideas.

(Update, much later: here are the details for how to create a copy of a VM without running the converter repeatedly.)

2
  • Unfortunately Converter is not being updated for Linux platform and the latest version 4.0.1 is not able to convert current versions of virtual machines. Converter for Windows running in a VM has problems accessing VMs through VMware shares. Sep 3, 2013 at 15:17
  • @pabouk that's only true for powered on machines, you can always clone vm to vm. Oct 15, 2015 at 2:49
5

You need console (or SSH) access to the ESXi server, and then you can copy your VMs around using standard UNIX commands (cp).

To get console access:

  • go to the server console
  • type ALT-F1
  • type "unsupported" without quotes (no echo)
  • type your password (no echo, again)

Now you are at the server's command prompt; if you want to enable SSH access, edit /etc/inetd.conf and remove che comment symbol ("#") from the SSH line.

4
  • While correct, there must be more to it than this; I couldn't get the copy of the VM to start properly. It would always PXE then stop with a claim of "no operating system". Jun 2, 2009 at 16:53
  • That's strange, I've always been able to copy VMs this way. Are you copying all the VM directory or just the VMX and/or VMDK files? Try copying the full VM directory to another location, importing the copied VM into ESXi and then starting it.
    – Massimo
    Jun 3, 2009 at 13:42
  • For me it also always worked by just copying the files. Plan B would be to copy only disk/vmdk files and create a new vm and later attach vmdks.
    – Jure1873
    Nov 5, 2010 at 14:04
  • 2
    Rather than using cp, use vmkfstools.
    – kbyrd
    May 23, 2011 at 20:10
3

There is a "ghetto-esx-linked-clones" script that will make Linked Clones rather than full clones. Linked clones are great for VMs that you intend to use for short-term testing, since the clones only store differences relative to the original VM. Running this script requires enabling SSH access to the ESXi host.

http://communities.vmware.com/docs/DOC-9202?tstart=7450

1

Leon Roy's advice worked for me. But I think there is something to consider: vmdk-files stored directly in the directory of the vm are linked with a relative path to the vmx-file whereas vmdks that are stored outside this directory are linked with an absolute path. So if one of the vmdks used by the VM is not situated in the same directory as the VM itself, you have to change the fileName value for that file in the vmx-file before re-adding it to the inventory. Otherwise, if you add the copied VM, it would use the original not the copy of the vmdk.

1

Using the converter was the most consistent approach to this solution. Manually copying files in ESX-i was easy, but takes the same amount of time as using the converter, and does not always let you add the .vmx file to the inventory (it can be grayed out). Keep this information list up; it's old, but it helped me :-)

0

Unless I'm sorely mistaken, you should be able to run the Virtual Infrastructure Client, connect to your ESXi server, right click on any stopped virtual machine and choose "Clone" which will duplicate the existing VM into another VM.

2
  • 2
    only when you are running on vCenter
    – lepole
    May 31, 2009 at 19:46
  • 1
    I can confirm, ESXi 3.5 does not let you clone VMs from the VIC. Jun 2, 2009 at 14:58
0

From memory the vCentre Server ( vmware.com/products/vi/vc/features.html ) will let you convert a machine into a template and then deploy multiple copies of that template into virtual machines. I believe there is a 60 day trial available ( vmware.com/tryvmware/index.php?p=vsphere&lp=1 ).

2
  • 2
    Only if you have Virtual Center - if you are running "Free ESX 3i" then you are limited in functionality.
    – Rob Bergin
    Jun 1, 2009 at 0:10
  • if it is a one hit the trial may work for that.
    – Antitribu
    Jun 1, 2009 at 9:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .