[libvirt] How do I import an old VM image to a new Install

Michael N. Moran mike at mnmoran.org
Wed Nov 25 16:36:28 UTC 2009

First, I am a casual VM user. I have been using
Fedora Core 7 on my Dell laptop for a couple of
years with a single QEMU/KVM guest running Windoze XP.

I recently installed Fedora 12 on a new hard disk
and would like to use my old Windows VM image
on the new install.

Is there an easy way to do this?

I tried copying the image itself (WindozeXpDisk.raw)
to the new install and then (naively) looked for an
import on the Virtual Machine Manager GUI. The closest
that I found was the File->Restore saved machine.
I tried that on my WindozeXpDisk.raw image and it
failed as follows:

Traceback (most recent call last):
   File "/usr/share/virt-manager/virtManager/manager.py", 
line 461, in restore_saved_callback
   File "/usr/share/virt-manager/virtManager/connection.py", 
line 649, in restore
   File "/usr/lib64/python2.6/site-packages/libvirt.py", 
line 1420, in restore
     if ret == -1: raise libvirtError ('virDomainRestore() 
failed', conn=self)
libvirtError: operation failed: image magic is incorrect

I *can* mount the image using kpartx et. al like this;

sudo kpartx -av /var/virt/WindozeXpDisk.raw
  add map loop1p1 (253:2): 0 31101777 linear /dev/loop1 63

sudo mount -t ntfs /dev/mapper/loop0p1 ./mnt

Any clues would be helpful.

thank you,

More information about the libvir-list mailing list