Skip to contentSkip to conversation

How to clone a running vm?

Qemu-devel Zhang Haoyu 3 participants 4 messages Jan 12, 2015

lore
Share & tools
lore
#0 lore raw

Hi,

I want to clone a running vm without shutoff, can below method work?
1) create a snapshot for the vm
2) create a new qcow2 image from the snapshot, but how?
3) use the new qcow2 image as backing image to clone vms

Any ideas?

Thanks,
Zhang Haoyu

#1 lore raw
Quoted 8 lines · Zhang Haoyu

Hi,

I want to clone a running vm without shutoff, can below method work?
1) create a snapshot for the vm
2) create a new qcow2 image from the snapshot, but how?
3) use the new qcow2 image as backing image to clone vms

Can drive_mirror clone a running vm without guest service disruption?

Quoted 4 lines

Any ideas?

Thanks,
Zhang Haoyu

#2 lore raw
Quoted 7 lines · Zhang Haoyu
Quoted 5 lines

I want to clone a running vm without shutoff, can below method work?
1) create a snapshot for the vm
2) create a new qcow2 image from the snapshot, but how?
3) use the new qcow2 image as backing image to clone vms

Can drive_mirror clone a running vm without guest service disruption?

Yes.

Paolo

#3 lore raw
In reply to Zhang Haoyu
Quoted 3 lines · Zhang Haoyu

Hi,

I want to clone a running vm without shutoff,

A number of people have expressed a desire to do this. But PLEASE consider the security implications. If you have two guests running from the same initial running state, without sanitizing at least one of the guests, then you have set yourself up for major security breaches if the two guests can be accessed on the same network.

Things you need to sanitize include, but are not limited to, all guest OS random number seeding, IP addresses, UUIDs, ssh keys, etc.

Quoted 4 lines

can below method work?
1) create a snapshot for the vm
2) create a new qcow2 image from the snapshot, but how?
3) use the new qcow2 image as backing image to clone vms

While you can indeed create a qcow2 image from a running guest, I highly suggest scrubbing and sanitizing that image before cloning new VMs that use that state; and that your new guests be booted from scratch rather than attempting to live-boot the cloned guests.

Signature · 2 lines
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org