[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

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



On 11/25/2009 12:53 PM, Cole Robinson wrote:
On 11/25/2009 11:36 AM, Michael N. Moran wrote:
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?

libvirtError: operation failed: image magic is incorrect


Restore isn't what you want here, and though the above error sounds
scary it is actually correct. Restore starts a VM that was previously
'saved', which is kind of like suspend to ram on a physical machine.

You should be able to use virt-install --import to get what you want,
something like

virt-install --name foo --ram 1024 --os-variant winxp --import --disk
path=/path/to/your/disk/image ...

Thanks Cole, that's what I was looking for. I used the
following line:

virt-install --name WindozeXP --ram 512 --os-variant winxp \
--import --disk path=/var/virt/WindozeXpDisk.raw

Virt Viewer came up and the XP boot screen was shown for
about a minute and then the I experienced a BSOD with an
UNMOUNTABLE_BOOT_VOLUME error.

I assume that the problem is that I need to specify a
VM that has the same virtual hardware characteristics as
my previous environment. I suppose that can be gleaned
from /etc/libvirt/qemu/WindozeXP.xml or similar.

I've attached that old WindozeXP.xml file in an attempt
to be complete.

If there is an easy way to import that information or
if I'm on the wrong track, please let me know.
<domain type='kvm'>
  <name>WindozeXP</name>
  <uuid>711a37f1-f06b-36ea-d413-17519ba1d717</uuid>
  <memory>524288</memory>
  <currentMemory>524288</currentMemory>
  <vcpu>1</vcpu>
  <os>
    <type>hvm</type>
    <boot dev='hd'/>
  </os>
  <features>
    <acpi/>
  </features>
  <clock offset='utc'/>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>destroy</on_crash>
  <devices>
    <emulator>/usr/bin/qemu-kvm</emulator>
    <disk type='file' device='disk'>
      <source file='/var/virt/WindozeXpDisk.raw'/>
      <target dev='hda'/>
    </disk>
    <disk type='file' device='cdrom'>
      <source file='/dev/cdrom'/>
      <target dev='hdc'/>
    </disk>
    <interface type='network'>
      <mac address='00:0b:db:1b:7e:f3'/>
      <source network='default'/>
      <target dev='vnet0'/>
    </interface>
    <input type='mouse' bus='ps2'/>
    <graphics type='vnc' port='-1' listen='127.0.0.1'/>
  </devices>
</domain>

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]