From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41089) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xtw7C-0002W7-9Q for qemu-devel@nongnu.org; Thu, 27 Nov 2014 05:16:07 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Xtw72-00023f-O5 for qemu-devel@nongnu.org; Thu, 27 Nov 2014 05:15:58 -0500 Received: from mail-pd0-x22a.google.com ([2607:f8b0:400e:c02::22a]:35002) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xtw72-00023L-CP for qemu-devel@nongnu.org; Thu, 27 Nov 2014 05:15:48 -0500 Received: by mail-pd0-f170.google.com with SMTP id fp1so4680594pdb.29 for ; Thu, 27 Nov 2014 02:15:42 -0800 (PST) From: "Halsey Pian" Date: Thu, 27 Nov 2014 18:15:31 +0800 Message-ID: <00b101d00a2b$1656c080$43044180$@gmail.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_00B2_01D00A6E.247CE6B0" Content-Language: zh-cn Subject: [Qemu-devel] Help: Convert HDD to QCOW2 img List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: halsey.pian@gmail.com This is a multipart message in MIME format. ------=_NextPart_000_00B2_01D00A6E.247CE6B0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 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 ------=_NextPart_000_00B2_01D00A6E.247CE6B0 Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

 

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

 

------=_NextPart_000_00B2_01D00A6E.247CE6B0--