qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] Help: Convert HDD to QCOW2 img


From: Halsey Pian
Subject: [Qemu-devel] Help: Convert HDD to QCOW2 img
Date: Thu, 27 Nov 2014 18:15:31 +0800

 

Hi All,

 

Recently, I'm writing an interface of wrapper class for QCOW2 in order to manage QCOW2 img files conveniently based on our requirements in my current project , this wrapper includes functions such as QCOW2 creating, read/write and snapshot relatives. Actually, these functions would finally call functions in qemu-img.c, block.c, qcow2.c and others related.

 

With respect to validation of this wrapper, I installed one VM to generate a fedora20.qcow2 file using qemu team's binary qemu-system_x86-64, and use my wrapper to read this file and write to a new QCOW2 file from sector 0 to total sectors the img includes,  finally I can boot the VM using my generated QCOW2 img file.

 

Unfortunately, I'm suffering issue below,

I connected the fedora20.qcow2 to /dev/nbd0 using support of qemu-nbd and kernel nbd moduel, and fread this block node as file and also write the data to a new QCOW2 file using bdrv_write implemented in block.c starting from sector 0, but this img file doesn't work successfully, error report below when starts up

 

Error: file 'grub2/i386-pc/normal.mod' not found

Grub rescue>

 

It seems the partition information is not wrote successfully into the img file, what did I miss? What else should I do except writing the data? Could you give help on it?

 

The reason why I did above is that I want to write a hard disk drive including  OS data (and can be started up normally as host) to qcow2 file, and then boot it as VM under qemu kvm support. Any idea or suggestion?

 

Host: Fedora20

VM: Fedora20

Kernel: 3.12.32

QEMU: 2.1.2

 

 

Thanks a lot!

 

 

Best Regards

Halsey Pian

 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]