[libvirt] how to duplicate an vm?

I am trying to duplicate an existing vm. While the VM was down, I copied the image file, copied the xml file and manually fixed the xml file to have a different VM name, and point to the copy. The copy now works, but the original disappraeed from virt-manager. When I try to "restore" it I get: Error restoring domain '/var/lib/libvirt/images/fc11-copy.img': operation failed: image magic is incorrect What am I doing wrong/how should I replicate a VM? Thanks, Dan

On Wed, Oct 21, 2009 at 04:58:00PM +0200, Dan Bar Dov wrote:
I am trying to duplicate an existing vm. While the VM was down, I copied the image file, copied the xml file and manually fixed the xml file to have a different VM name, and point to the copy.
The copy now works, but the original disappraeed from virt-manager. When I try to "restore" it I get: Error restoring domain '/var/lib/libvirt/images/fc11-copy.img': operation failed: image magic is incorrect
What am I doing wrong/how should I replicate a VM?
Did you change the UUID and network mac address? We also have a tool that does this called virt-clone. It might be safer/easier to use the tool instead of doing it by hand. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones New in Fedora 11: Fedora Windows cross-compiler. Compile Windows programs, test, and build Windows installers. Over 70 libraries supprt'd http://fedoraproject.org/wiki/MinGW http://www.annexia.org/fedora_mingw

Thanks, I was not aware of virt-clone. Dan On Wed, Oct 21, 2009 at 4:59 PM, Richard W.M. Jones <rjones@redhat.com>wrote:
On Wed, Oct 21, 2009 at 04:58:00PM +0200, Dan Bar Dov wrote:
I am trying to duplicate an existing vm. While the VM was down, I copied the image file, copied the xml file and manually fixed the xml file to have a different VM name, and point to the copy.
The copy now works, but the original disappraeed from virt-manager. When I try to "restore" it I get: Error restoring domain '/var/lib/libvirt/images/fc11-copy.img': operation failed: image magic is incorrect
What am I doing wrong/how should I replicate a VM?
Did you change the UUID and network mac address?
We also have a tool that does this called virt-clone. It might be safer/easier to use the tool instead of doing it by hand.
Rich.
-- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones <http://people.redhat.com/%7Erjones> New in Fedora 11: Fedora Windows cross-compiler. Compile Windows programs, test, and build Windows installers. Over 70 libraries supprt'd http://fedoraproject.org/wiki/MinGW http://www.annexia.org/fedora_mingw
participants (2)
-
Dan Bar Dov
-
Richard W.M. Jones