We have a sysadmin who is cloning one of our production servers, which is a VMWare VM. The total time to clone it seems to be about 2 hours. The server is still running (serving web apps) while he does the clone.

Obviously, things are changing on the server's hard drive and in memory during those two hours. How can we end up with a consistent copy of the machine? Or are we supposed to end up with an inconsistent copy?? Will we end up with a VM that partially resembles what the original VM looked like at 7:00am, another part of it reflects what the original looked like at 8:00am, etc.?

We're running VMWare vCenter Server 4.1, if that matters.

  • Have you tried taking a snapshot and creating a linked clone? That would keep it consistent, and linked clones clone quickly. You can choose to capture the current memory or not, depending on what you need.
    – smcg
    Aug 17 '12 at 14:07
  • @smcg: I don't get to touch the production VMs, so I haven't tried anything. Are you saying that cloning the running VM would not result in a consistent copy? We don't necessarily need to capture current memory, but if we don't, wouldn't the resulting clone be like a machine that was unplugged in the middle of running apps, that had no chance to shut down cleanly?
    – LarsH
    Aug 17 '12 at 14:14
  • 1
    If you quiesce the file system when you create the snapshot (there's an option for that) it will pause all running processes, take the snapshot, and then resume them. (assuming you do want to keep the processes running on the clone. if you don't, don't copy the memory or quiesce.) en.wikipedia.org/wiki/Quiesce
    – smcg
    Aug 17 '12 at 14:36

What you're talking about is called "hot-cloning," and doing such a clone will result in some level of inconsistency between the two copies. Every way I'm aware of, including the commercial and native implementations of hot-cloning involve taking a snapshot (in one form or another) and then cloning that. This freezes the disk at a certain point in time, so that your disk is consistent, but it does result in having a clone that's from a point in time in the past.

  • OK, I didn't know that hot-cloning worked by taking a snapshot (which freezes the VM for a second or two?), and thus guarantees a consistent disk. That makes me feel better. To me it doesn't matter if the clone reflects a point in time in the past. The clone will be used for dev / test / QA tiers.
    – LarsH
    Aug 17 '12 at 14:50

By rights, the full process would be:

  1. Create a snapshot of the running machine; this frees up the underlying disk files and causes new data changes to be written to delta files
  2. Copy the main disk files to the new machine
  3. Create another snapshot of the running machine; this frees up the delta files and causes new data changes to be written to new delta files
  4. Copy the old delta files to the new machine
  5. Repeat until the delta files are small enough to copy that the time taken represents negligable changes to the source server
  6. Edit the clone's config file so it is aware of the copied delta files
  7. Merge the clone's delta files back into the clone's main disk file

Depending on the tool used to do the clone, it may not do the delta file loop, so you would end up with a clone based on the how the server looked at the start of the first snapshot.

Even if it does the delta loop, you will still technically end up with a clone that is momentarily behind the source server.

Really, the only way to make a clone that is an exact match of the source server is to take the copy while the source VM is powered down.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.