copy vmware vmdk files while vm is running

27,354

Solution 1

See this article and this one, seems like what you're looking for.

here's the process:

Taking a snapshot of the source VM using vmware-cmd.

Create a new VM and delete all vmdks in it

Copy the vmdk files from your snapshot into your new using vmkfstools.

Fix your configurations files accordinately.

Hope this helps.

Solution 2

For anyone reading this thread that has VMware Workstation, then to produce an independent functioning copy (ie a backup) is not possible according to the user guide without shutting down the VM first. The Uranium backup application will copy VMs while they are running but it is not cheap (150 Euro's) for a small startup like mine. I found in practice that simply suspending the VM and copying the files to a backup location works fine; giving a fully independent copy. The VM is only offline during the copy phase, and will resume its programs and files state after the copy is done. When you start the backed up VM it will ask whether you have moved it or copied it. Copying the files of an active VM is understandably risky, as the backup may not function due to state changes during the backup. So I wrote a very basic script to suspend the VM, copy the files to another location, then Resume the VM. Send me an email if you would like a copy.

Share:
27,354

Related videos on Youtube

zero_r
Author by

zero_r

Updated on September 17, 2022

Comments

  • zero_r
    zero_r almost 2 years

    I need to copy some VMs from one datastore to another. I'm running ESX 3.5 U3, VMs are mostly Windows-based. I don't care about data integrity since it's only to test NetApps deduplication on the target destination and the VMs will never be running from this files. Since the VMs are used, i cannot shut them down. If I try to copy it with 'cp' of course I get errors complaining about locked files.

    E.g.: "cp: cannot open ....vmdk' for reading: Device or resource busy"

    Is there a trick to do this? With dd or cpio?

    Regards

  • Helvick
    Helvick almost 15 years
    I've done this a few times, works a treat. You will need to go digging in the config files (vmx/.vmdk's) on the target system if you actually want to be able to power up the resulting VM's but if all you want to do is test dedupe then it shouldn't matter a lot if the resulting files can be used to power up a VM or not.