VMware Cloud Community
xiaoxiaoxin
Contributor
Contributor
Jump to solution

How to clone a VM on a ESXI 6.5 server?

I tried to copy the vmdk and vmx file from a original vm folder to a new vm folder on the web interface. But the size of vmdk file is only 561B. If I boot the VM I get the error "couldn't find disk file".

I also tried use the command "vmkfstools -i /vmfs/volumes/datastore/BaseVM/BaseVM.vmdk /vmfs/volumes/datastore/NewVM/newvm.vmdk", but I get a flat.vmdk in the newVM folder. And the VM could't boot, too.

I want to know what is the right way to clone a VM on a ESXI 6.5 server. Thanks.

Tags (1)
1 Solution

Accepted Solutions
vasan22in
Enthusiast
Enthusiast
Jump to solution

Refer the link, it will be useful

6- Clone A virtual machine without vCenter in ESXI Free edition - YouTube  .....

Please consider marking this answer "correct" or "helpful" if you think your query have been answered correctly. Thanks, Srini

View solution in original post

0 Kudos
13 Replies
daphnissov
Immortal
Immortal
Jump to solution

Do you know about the host client? https://<fqdn>/ui. Right-click a VM and clone.

0 Kudos
xiaoxiaoxin
Contributor
Contributor
Jump to solution

I'm using the https://Server_IP/ui. But I didn't find the "clone" button. I right click on a VM I see "Power, Guest OS, Snapshots, Console, Export, Unregister, Delete......" , but no "clone". menu.jpg

0 Kudos
daphnissov
Immortal
Immortal
Jump to solution

My mistake, I could have sworn that was in the 6.5 host client. Are you using vCenter Server or no?

0 Kudos
xiaoxiaoxin
Contributor
Contributor
Jump to solution

No, I don't have vCenter Server. How can I do it?

0 Kudos
daphnissov
Immortal
Immortal
Jump to solution

Probably the simplest way is to use the vmkfstools command with the -i flag. Make sure to specify the disk type with the -d flag at the end. Pre-create your destination directory, then issue the command that clones the source disk to the destination directory. When complete, you should have <name>.vmdk and a <name>-flat.vmdk files in that directory. Create a new VM using the wizard in the host client, delete the default blank disk, and select to use an exist disk. Browse and locate the cloned disk making sure to create your new VM with the same type of storage controller, otherwise it may not boot. You should be successful at that point.

0 Kudos
vasan22in
Enthusiast
Enthusiast
Jump to solution

Refer the link, it will be useful

6- Clone A virtual machine without vCenter in ESXI Free edition - YouTube  .....

Please consider marking this answer "correct" or "helpful" if you think your query have been answered correctly. Thanks, Srini
0 Kudos
xiaoxiaoxin
Contributor
Contributor
Jump to solution

I have tried this way on web client  yesterday but failed. The size of vmdk was only 561B in the new VM folder.

I tried it with vSphere client 6.0 on my ESXI 6.5 server just now. It works this time. I think the web client has some bugs.

Thanks for all of your helps.

0 Kudos
daphnissov
Immortal
Immortal
Jump to solution

I tried this myself yesterday on an ESXi 6.5 U1 system using the method I outlined, and I had no problems. the .vmdk file is supposed to be very small as it's metadata descriptor only. The *-flat.vmdk is the disk extent (i.e., where the data is stored).

0 Kudos
xiaoxiaoxin
Contributor
Contributor
Jump to solution

I get two vmdk files, too. But it can't find disk when I boot the VM. I run ESXI 6.5a.

I success with Vsphere Client and fail with web client on the same way.

Anyway, thank you for your answer. Smiley Happy

0 Kudos
adam_ginsberg
Contributor
Contributor
Jump to solution

From my own experience, using the vCenter Converter Standalone is the simplest method.  Point it to your existing ESXi server, select the VM you want to clone, tell it to create it on the same (or different ESXi server), verify config of the new VM, and let if fly.  It will do P2V and V2V conversions, quite easily.  No need to copy files around, rename files, etc.  Let the tool do the work for you.

timoruo
Contributor
Contributor
Jump to solution

Does the Converter still work on 6.7? I just tried it on Ubuntu 18.04 VM and while the cloning was fast and convenient, the outcome was a seriously broken VM, missing eth adapter, VMware tools and who knows what.

0 Kudos
GrangerX
Contributor
Contributor
Jump to solution

Hi all,

If you turn on the setting so you can SSH into the ESXi server, I wrote a shell script that clones VMs and works pretty well:

 

https://grangerx.wordpress.com/2020/09/23/vmware-esxi-script-to-clone-a-vm/

I placed the file in /vmfs/volumes/datastore/_scripts_/clonevm

Thus, the usage is:
/vmfs/volumes/datastore1/_scripts_/clonevm.sh <servertoclone> <nameofclone>

It also lets you change the format of the VMDKs (thin, thick-eager, etc) as part of the clone operation if you desire.

Thanks,

GrangerX

 

 

Thanks,

GrangerX

jlenabu
Contributor
Contributor
Jump to solution

Outstanding!  Thank you very much for this, found it searching around.

Tried saving file in Windows and WINSCPing it over but it wouldn't work.

Found the note about the CRLF in the file.

Created the file using WINSCP and pasting it there and it worked like a charm.

0 Kudos