VMware vSphere

 View Only
  • 1.  Copy VM with all Snapshots and preserve thin provision

    Posted Apr 25, 2021 11:15 PM

    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



  • 2.  RE: Copy VM with all Snapshots and preserve thin provision

    Posted Apr 26, 2021 11:09 AM

    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é



  • 3.  RE: Copy VM with all Snapshots and preserve thin provision

    Posted Apr 26, 2021 12:21 PM

    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



  • 4.  RE: Copy VM with all Snapshots and preserve thin provision

    Posted Jun 07, 2022 09:31 PM

    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



  • 5.  RE: Copy VM with all Snapshots and preserve thin provision

    Posted Jun 07, 2022 09:52 PM

    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