VMware Cloud Community
ricky73
Hot Shot
Hot Shot

clone Vm with snapshot

I need to clone VM but I have to keep all snapshots in vCenter 6.0 (ESXi 6.0) environment, so I thought to create new datastore where I'll copy all content from source datastore.

But when I add to inventory new virtual machine I can get issues ? Duplicated VM ?

What do you suggest me please?

Tags (1)
10 Replies
NathanosBlightc
Commander
Commander

Hi Ricky,

It's not bad to check the following links. I think they will guide you to choose the best action in your situation:

VMware Knowledge Base

VMware – Clone a VM with snapshots (and consolidate it) – driftar's Blog

Please mark my comment as the Correct Answer if this solution resolved your problem
ricky73
Hot Shot
Hot Shot

I checked article you indicated but It says about snapshot consolidation infac It uses vmktools to clone and consolidate disks.

I'm interesting to keep all snapshots in the new virtual machine.

Reply
0 Kudos
Lalegre
Virtuoso
Virtuoso

Hey ricky73​,

May I ask you why do you need to keep the Snapshots?

Reply
0 Kudos
ricky73
Hot Shot
Hot Shot

Because my vm is working and It has specific snapshot which is specific state for upgrade; I can power off It for few minutes.

Now I need to make several test, which will occur much time, on new virtual machine with same snapshot.

Reply
0 Kudos
ricky73
Hot Shot
Hot Shot

Can I copy all vmdk files to another datatstore and I can make 'add to inventory" ?

Reply
0 Kudos
Lalegre
Virtuoso
Virtuoso

No Ricky, is not possible as the metadata of that chain is store in vCenter and when you clone the VM it will have a new MoRef ID which is not attached to the current Snapshots.

If you clone, consolidation will happen, however if your VM is currently working you can leave the original VM powered-off and work with the clone, if something fails you can power it on.

Reply
0 Kudos
NathanosBlightc
Commander
Commander

First of all you should know you can run "add to inventory" operation just for .vmx (VM configuration file) not other types like vmdk.

BTW I think you complicate it, because it's easier to create a clone and do whatever you need, then remove that clone or create another one for another test.

Snapshot is not simple as you may think. This operation include some interaction and modification about .vmdk, .vmsn and .vmsd files. If you like to know read my post here:

Virtual Machine Snapshot Details Investigation - Part 1

Please mark my comment as the Correct Answer if this solution resolved your problem
Reply
0 Kudos
ricky73
Hot Shot
Hot Shot

Infact I would copy both vmdk (cp command) and vmx files by ESXi shell directly oh host, I don't understand what happens if I add to inventory the new machine: I see or not snapshot ?

Reply
0 Kudos
continuum
Immortal
Immortal

> Can I copy all vmdk files to another datatstore and I can make 'add to inventory" ?

Yes - before you add the copied vmx-file to the inventory make sure it has a new unique  name and also delete all vmx-file entries that have uuid in the name.

If the original VM is spread over more than one directory you may also need to adjust paths in the vmdk descriptorfiles.


________________________________________________
Do you need support with a VMFS recovery problem ? - send a message via skype "sanbarrow"
I do not support Workstation 16 at this time ...

ricky73
Hot Shot
Hot Shot

I thought unique name was assigned at "power on" stage by vCenter when It detects that the copied vm has the same uuid of the source one.

In vmx file there is uuid.bios, vc.uuid, uuid.location, It's necessary to change only uuid.bios and uuid.location ? I have to the new uuid ?

While in disk descriptor vmdk file, I have to change only parentFileNameHint="/vmfs/volumes/DATASTORE/vm-name/vm-name.vmdk" where I'll change DATASTORE with the new one, ok ?

Reply
0 Kudos