rb78
Contributor
Contributor

Copy VM with all Snapshots and preserve thin provision

Dear all,

we are using ESXi 6.7U3 and I want simple copy 1000 VMs from our datastore a fast a possible to another datastore. I don't want "migrate" them - I want to create a copy. All VMs are using thin provisioning and this must be preserved. Therefore the "cp" command with SSH doesn't work as expected.

Can anybody give me a hint what can I do to archive my goal?

 

Best regards


Rainer

Moderator note by wila: Moved post from Skyline community discussions to VMware vSphere discussions

0 Kudos
4 Replies
a_p_
Leadership
Leadership

The 'cp' command isn't optimized for VMFS partitions, and - as you found out - isn't thin provisioning aware.

To copy the base (thin provisioned) disks use vmkfstools -i <source.vmdk> -d thin <target.vmdk>. Once the virtual disk is copied/cloned, you may want to check whether the new disk's header .vmdk file has the same "CID" (required to maintain the snapshot chain). If that's not the case, use the "cp" command to copy the header .vmdk file from the "old" datastore to the new one again.

André

0 Kudos
rb78
Contributor
Contributor

Hey,

 

thank you for your feedback. I tried it now with rsync and all my tests are successfully. Its much slower than cp but it works.

 

Best regards


Rainer

0 Kudos
bytesaber
Contributor
Contributor

Can you tell us more about how you used rsync?  This command is not present on the command line of ESXi.  Did you use it from a Linux host externally somehow?  Can you provide an example?

Thank you

0 Kudos
continuum
Immortal
Immortal

I would suggest to
use vmkfstools -i for the flat.vmdks
use cp for all small files like vmdk-descriptor, vmx, vmsd, logs
use dd for all sesparse.vmdks or delta.vmdks
ignore all *.vswp files

You can use rsync but that requires installing a thirdparty binary to ESXi which is possible but not trivial at all.

To use rsync from a Linux LiveCD use sshfs: mount the source directory in readonly mode and the target directory in writeable mode.
I do that with ddrescue regularly while doing recovery work - BUT it is SLOW because everything goes through ssh twice.

If this is a task you have to do once I would recommend to use vmkfstools + cp + dd as described above.
Create a sh-script to automate and dont forget to adjust paths in the vmx-files if necessary.

Ulli


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

0 Kudos